Exemplo n.º 1
0
void CAIGoalAttackProp::UpdateGoal()
{
	CAIState* pState = m_pAI->GetState();

	switch(pState->GetStateType())
	{
		case kState_HumanAttackProp:
			HandleStateAttackProp();
			break;

		case kState_HumanDraw:
			HandleStateDraw();
			break;

		case kState_HumanAware:
			break;

		case kState_HumanPanic:
			HandleStatePanic();
			break;

		// Unexpected state.
		default: AIASSERT(0, m_pAI->m_hObject, "CAIGoalAttackProp::UpdateGoal: Unexpected State.");
	}
}
Exemplo n.º 2
0
void CAIGoalFollowFootprint::UpdateGoal()
{
	CAIState* pState = m_pAI->GetState();

	switch(pState->GetStateType())
	{
		case kState_HumanFollowFootprint:
			HandleStateFollowFootprint();
			break;

		case kState_HumanAware:
			break;

		case kState_HumanSearch:
			HandleStateSearch();
			break;

		case kState_HumanDraw:
			HandleStateDraw();
			break;

		// Unexpected State.
		default: AIASSERT(0, m_pAI->m_hObject, "CAIGoalFollowFootprint::UpdateGoal: Unexpected State.");
	}
}
Exemplo n.º 3
0
void CAIGoalRespondToBackup::UpdateGoal()
{
	CAIState* pState = m_pAI->GetState();

	switch(pState->GetStateType())
	{
		case kState_HumanGoto:
			HandleStateGoto();
			break;

		case kState_HumanSearch:
			HandleStateSearch();
			break;

		case kState_HumanDraw:
			HandleStateDraw();
			break;

		case kState_HumanAware:
			break;

		// Unexpected State.
		default: AIASSERT(0, m_pAI->m_hObject, "CAIGoalRespondToBackup::UpdateGoal: Unexpected State.");
	}
}
Exemplo n.º 4
0
//----------------------------------------------------------------------------
//              
//	ROUTINE:	CAIGoalResurrecting::UpdateGoal()
//              
//	PURPOSE:	
//              
//----------------------------------------------------------------------------
void CAIGoalResurrecting::UpdateGoal()
{
	if (m_bReactivateGoalOnUpdate)
	{
		ActivateGoal();
		m_bReactivateGoalOnUpdate = LTFALSE;
	}

	CAIState* pState = m_pAI->GetState();

	switch(pState->GetStateType())
	{
		case kState_HumanResurrecting:
			HandleStateResurrecting();
			break;

		case kState_HumanAware:
			break;

		case kState_HumanSearch:
			HandleStateSearch();
			break;

		case kState_HumanDraw:
			HandleStateDraw();
			break;

		// Unexpected State.
		default: AIASSERT(0, m_pAI->m_hObject, "CAIGoalResurrecting::UpdateGoal: Unexpected State.");
	}
}
void CAIGoalDisappearReappear::UpdateGoal()
{
	CAIState* pState = m_pAI->GetState();

	switch(pState->GetStateType())
	{
		case kState_HumanDisappearReappear:
			HandleStateDisappearReappear();
			break;

		// Unexpected State.
		default: AIASSERT1(0, m_pAI->m_hObject, "CAIGoalDisappearReappear::UpdateGoal: Unexpected State: %s.", s_aszStateTypes[pState->GetStateType()] );
	}
}
Exemplo n.º 6
0
void CAIGoalGoto::UpdateGoal()
{
	CAIState* pState = m_pAI->GetState();

	switch(pState->GetStateType())
	{
		case kState_HumanGoto:
			HandleStateGoto();
			break;

		// Unexpected State.
		default: AIASSERT(0, m_pAI->m_hObject, "CAIGoalGoto::UpdateGoal: Unexpected State.");
	}
}
Exemplo n.º 7
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CAIGoalCatch::UpdateGoal
//
//	PURPOSE:	Update goal.
//
// ----------------------------------------------------------------------- //
void CAIGoalCatch::UpdateGoal(void)
{
	CAIState* pState = m_pAI->GetState();

	// Handle each State this Goal is implemented in terms of
	switch(pState->GetStateType())
	{
		case kState_HumanCatch:
			HandleStateCatch();
			break;

		// Unexpected State.
		default: UBER_ASSERT(0, "CAIGoalCatch::UpdateGoal: Unexpected State.");
	}
}
Exemplo n.º 8
0
void CAIGoalDistress::UpdateGoal()
{
	CAIState* pState = m_pAI->GetState();

	switch(pState->GetStateType())
	{
		case kState_HumanDistress:
			HandleStateDistress();
			break;

		case kState_HumanPanic:
			HandleStatePanic();
			break;

		// Unexpected State.
		default: ASSERT(!"CAIGoalDistress::UpdateGoal: Unexpected State.");
	}
}
Exemplo n.º 9
0
void CAIGoalAttackRangedDynamic::UpdateGoal()
{
	CAIState* pState = m_pAI->GetState();

	switch( pState->GetStateType() )
	{
		// Move around between attacks.

		case kState_HumanAttack:
			{
				CAIHumanStateAttack* pAttackState = (CAIHumanStateAttack*)m_pAI->GetState();

				// Do not move immediately after a dodge.

				if( pAttackState->IsDodging() )
				{
					ResetMoveTime();
				}

				// It is time to move between attacks.

				else if( ( !m_pAI->GetAnimationContext()->IsLocked() ) && 
						 ( g_pLTServer->GetTime() > m_fMoveTime ) )
				{
					ResetMoveTime();

					// We are done if we found a valid move.

					if( SelectAttackMove() )
					{
						return;
					}
				}
			}
			break;

		case kState_HumanAttackMove:
			HandleStateAttackMove();
			return;
	}

	super::ActivateGoal();
}
Exemplo n.º 10
0
void CAIGoalGuard::UpdateGoal()
{
	CAIState* pState = m_pAI->GetState();

	switch(pState->GetStateType())
	{
		// If state is idle, and a guard node is set, set state to goto.
		case kState_HumanIdle:
			HandleStateIdle();
			break;

		case kState_HumanGoto:
			HandleStateGoto();
			break;

		// State should only be idle or goto.
		default: AIASSERT(0, m_pAI->m_hObject, "CAIGoalGuard::UpdateGoal: Unexpected State.");
	}
}
Exemplo n.º 11
0
void CAIGoalAbstractUseObject::UpdateGoal()
{
	CAIState* pState = m_pAI->GetState();

	switch(pState->GetStateType())
	{
		case kState_HumanHolster:
			HandleStateHolster();
			break;

		case kState_HumanUseObject:
			HandleStateUseObject();
			break;

		case kState_HumanIdle:
			if( !m_pAI->GetAnimationContext()->IsTransitioning() )
			{
				/*
				if( m_bHolstered )
				{
					m_pAI->SetState( kState_HumanDraw );
					m_pAI->GetState()->PlayFirstSound( LTFALSE );
				}
				else {
					CompleteUseObject();
				}
				*/

				CompleteUseObject();
			}
			break;

		case kState_HumanDraw:
			HandleStateDraw();
			break;

		// Unexpected State.
		default: ASSERT(!"CAIGoalAbstractUseObject::UpdateGoal: Unexpected State.");
	}
}
Exemplo n.º 12
0
void CAIGoalPatrol::UpdateGoal()
{
	CAIState* pState = m_pAI->GetState();

	switch(pState->GetStateType())
	{
		// If state is idle, and a patrol node is set, set state to patrol.
		case kState_HumanIdle:
			HandleStateIdle();
			break;

		case kState_HumanPatrol:
			HandleStatePatrol();
			break;

		case kState_HumanDraw:
			HandleStateDraw();
			break;

		// State should only be idle or patrol.
		default: AIASSERT(0, m_pAI->m_hObject, "CAIGoalPatrol::UpdateGoal: Unexpected State.");
	}
}
Exemplo n.º 13
0
//----------------------------------------------------------------------------
//              
//	ROUTINE:	CAIGoalResurrecting::HandleNameValuePair()
//              
//	PURPOSE:	
//              
//----------------------------------------------------------------------------
/*virtual*/ LTBOOL CAIGoalResurrecting::HandleNameValuePair(const char* szName,const char* szValue)
{
	if ( !strcmp( szName, "RESETGOAL" ))
	{

		const CAIGoalAbstract* pCurGoal = m_pAI->GetGoalMgr()->GetCurrentGoal();
		bool bIsThisGoalAIsCurrentGoal = ( (pCurGoal==NULL) ? (false) : (pCurGoal->GetGoalType()==GetGoalType()) );
		if ( !bIsThisGoalAIsCurrentGoal )
		{
			return LTFALSE;
		}

//		const CAIGoalAbstract* pCurGoal = m_pAI->GetGoalMgr()->GetCurrentGoal();
//		bool bIsThisGoalAIsCurrentGoal = ( (pCurGoal==NULL) ? (false) : (pCurGoal->GetGoalType()==GetGoalType()) );
//		if ( !bIsThisGoalAIsCurrentGoal )
//		{
//			CAIGoalAbstract* pGoal = GetGoalMgr()->FindGoalByType( kGoal_Resurrecting );
//			if ( pGoal != NULL )
//			{
//				// If we have the goal, but it is not active, then do nothing
//				// because the Resurrecting goal either has not started, or
//				// some other goal has trumped it.
//			}
//			else
//			{
//				// If we do not have the goal, then this is an error condition
//				// because we cannot legally be here!
//				AIASSERT( 0, m_pAI->m_hObject, "Reseting Resurrect Goal when not active." );
//			}
//		}

		CAIState* pState = m_pAI->GetState();
		if ( !pState )
		{
			AIASSERT( 0, m_pAI->m_hObject, "Reseting Resurrect Goal with no state." );
			return LTFALSE;
		}

		switch(pState->GetStateType())
		{
			case kState_HumanResurrecting:
				// If we are still resurrecting, do nothing!
				break;

			case kState_HumanAware:
				// If we are currently aware, then reset the Goal
				m_bReactivateGoalOnUpdate = LTTRUE;
				break;

			case kState_HumanSearch:
				// If we are currently searching, then reset the Goal
				m_bReactivateGoalOnUpdate = LTTRUE;
				break;

			// Unexpected State.
			default:
				AIASSERT(0, m_pAI->m_hObject, "CAIGoalResurrecting::UpdateGoal: Unexpected State.");
		}
	}

	return LTFALSE;
}