Esempio n. 1
0
void Monster::ProcessTurn(const float dt, const D3DXVECTOR2 playerPosition, const X3DAUDIO_LISTENER* playerListener)
{
	// Check if the monster is still alive.
	if (CheckIfAlive(dt))
	{
		UpdateEmitterPosition();
		ApplySoundEffects(playerListener);

		// If time to move
		if (TimerCheck(movementTimer, dt, MOVEMENT_TIME_DELAY))
			ProcessMovement(playerPosition);
	}
	else
	{
		// The monster is dead, set alive value to false and play death sound.
		alive = false;
		deathSound->Play();
	}
} // End of ProcessTurn function.
Esempio n. 2
0
//------------------------------------------------------------------------
void CParachute::Update( SEntityUpdateContext& ctx, int slot)
{
    CItem::Update(ctx, slot);

    // check ground contact. release on landing
    /*if (IsOpened())
    {
      CActor* pActor = GetOwnerActor();
      if (pActor->GetActorStats()->inAir > 0) //&& contact)
      {
        //Close(false);
      }
      m_inAir = pActor->GetActorStats()->inAir;
    }*/

    if (IsOpened())
        ProcessMovement(ctx.fFrameTime);

    m_movementAction.Clear();
}
Esempio n. 3
0
void Camera::Update(float deltaTime)
{
	if (moveBackWard)
		ProcessMovement(BACKWARD, deltaTime);
	if (moveForward)
		ProcessMovement(FORWARD, deltaTime);
	if (moveLeft)
		ProcessMovement(LEFT, deltaTime);
	if (moveRight)
		ProcessMovement(RIGHT, deltaTime);
	if (moveUp)
		ProcessMovement(UP, deltaTime);
	if (moveDown)
		ProcessMovement(DOWN, deltaTime);
}
Esempio n. 4
0
void CFlyer::PrePhysicsUpdate()
{
	if(m_stats.isRagDoll)
		return;

	if(GetHealth() <= 0.f)
		return;

	IEntity *pEntity = GetEntity();

	if(pEntity->IsHidden())
		return;

	if(IPhysicalEntity *pPhysicalEntity = pEntity->GetPhysics())
	{
		pe_player_dynamics player_dynamics;
		player_dynamics.gravity.zero();
		pPhysicalEntity->SetParams(&player_dynamics);
	}

	float frameTime = gEnv->pTimer->GetFrameTime();

	if(m_pMovementController)
	{
		SActorFrameMovementParams params;
		m_pMovementController->Update(frameTime, params);
	}

	if(m_linkStats.CanMove() && m_linkStats.CanRotate())
	{
		ProcessMovement(frameTime);

		if(m_pAnimatedCharacter)
		{
			m_pAnimatedCharacter->AddMovement(m_moveRequest);
		}
	}
}
Esempio n. 5
0
void ZActor::OnUpdate(float fDelta)
{
	if(m_pVMesh) {
		m_pVMesh->SetVisibility(1.f);
	}

	if (CheckFlag(AF_MY_CONTROL))
	{
		m_TaskManager.Run(fDelta);
		CheckDead(fDelta);

		ProcessNetwork(fDelta);

		// for test - bird
		if (m_bTestControl)
		{
			TestControl(fDelta);
		}
		else
		{
			__BP(60,"ZActor::OnUpdate::ProcessAI");
			if(isThinkAble())
				ProcessAI(fDelta);
			__EP(60);
		}

		ProcessMovement(fDelta);
	}
	
	ProcessMotion(fDelta);

	if (CheckFlag(AF_MY_CONTROL))
	{
		UpdateHeight(fDelta);
	}
}
Esempio n. 6
0
void loop()
{
	Update();
	if (MENU) ProcessMenu();
	else ProcessMovement();
}