Example #1
0
//--------------------------------------------------------------------------------------
// Makes the soldier attack a target at the given position.
// Param1: The time in seconds passed since the last frame.
// Returns the current state of the action.
//--------------------------------------------------------------------------------------
BehaviourStatus Soldier::Attack(float deltaTime)
{
	m_combatManager.ShootAt(GetAttackTarget());
	// Wait until the weapon is ready again for the next shot
	SetReadyForAttack(false);
	return StatusSuccess;
}
Example #2
0
void CAIThread::NormalMove()
{
	float	nDist;

	if ( m_pMoveTarget != NULL )
	{
		nDist = ( m_vBotOrigin - m_pMoveTarget->GetOrigin() );
		if ( (nDist < MOVE_DISTANCE) || (nDist > MOVE_DISTANCE*3) )
		{
			m_pMoveTarget = NULL;
		}
	}
	if ( m_pAttackTarget == NULL )
	{
		GetAttackTarget();
	}
	if ( m_pMoveTarget == NULL )
	{
		GetMoveTarget();
	}
	MoveToMapPoint();
}
Example #3
0
//--------------------------------------------------------------------------------------
// Makes the soldier aim at a given position.
// Param1: The time in seconds passed since the last frame.
// Returns the current state of the action.
//--------------------------------------------------------------------------------------
BehaviourStatus Soldier::AimAt(float deltaTime)
{
	m_movementManager.LookAt(GetAttackTarget());
	return StatusSuccess;
}