// ----------------------------------------------------------------------- // // // ROUTINE: CAIGoalCatch::ActivateGoal // // PURPOSE: Activate goal. // // ----------------------------------------------------------------------- // void CAIGoalCatch::ActivateGoal(void) { super::ActivateGoal(); if (m_hStimulusTarget==LTNULL) { SetCurImportance(0); AITRACE(AIShowGoals, ( m_pAI->m_hObject, "Aborting Goal %s\n", s_aszGoalTypes[GetGoalType()] ) ); return; } // Ignore senses other than see enemy. m_pAI->SetCurSenseFlags( kSense_SeeEnemy | kSense_SeeDangerousProjectile | kSense_SeeCatchableProjectile ); m_pGoalMgr->LockGoal(this); m_pAI->SetState( kState_HumanCatch ); // Set state specific information.. CAIHumanStateCatch* pCatchInstance = (CAIHumanStateCatch*)m_pAI->GetState(); // Save the object we intend to catch pCatchInstance->SetObjectToCatch( m_hStimulusTarget ); // Set the animations to use pCatchInstance->SetAnimationSequence( kAP_StartCatch, kAP_HoldCatch, kAP_EndCatch ); }
// ----------------------------------------------------------------------- // // // ROUTINE: CAIGoalCatch::OnLinkBroken // // PURPOSE: Handles a deleted object reference. // // ----------------------------------------------------------------------- // void CAIGoalCatch::OnLinkBroken( LTObjRefNotifier *pRef, HOBJECT hObj ) { float flImportance = GetCurImportance(); CAIGoalAbstractStimulated::OnLinkBroken( pRef, hObj ); SetCurImportance(flImportance); m_hStimulusTarget = NULL; }
//---------------------------------------------------------------------------- // // ROUTINE: CAIGoalAbstractStimulated::OnRelationshipBroken() // // PURPOSE: When a relationship changed, give the goal a chance to adjust // itself to accordingly. Currently, just make the goal // unimportant // //---------------------------------------------------------------------------- /*virtual*/ int CAIGoalAbstractStimulated::OnRelationChange(HOBJECT hObject) { if( (m_eOnRelationChangeAction == eNullImportance) && (m_hStimulusSource == hObject || m_hStimulusTarget == hObject) ) { m_hStimulusTarget = NULL; m_hStimulusSource = NULL; SetCurImportance( 0.0f ); } return 0; }
//---------------------------------------------------------------------------- // // ROUTINE: CAIGoalResurrecting::HandleStateResurrecting() // // PURPOSE: // //---------------------------------------------------------------------------- void CAIGoalResurrecting::HandleStateResurrecting() { switch( m_pAI->GetState()->GetStateStatus() ) { case kSStat_Initialized: break; case kSStat_Resurrecting: break; case kSStat_RegainingConsciousness: break; case kSStat_Conscious: { // Reset AIs default senses, from aibutes.txt. m_pAI->ResetBaseSenseFlags(); m_pGoalMgr->UnlockGoal(this); if ( m_pAI->CanSearch() ) { // Search. SetStateSearch(); } else { // Go aware. m_pAI->SetState( kState_HumanAware ); } // Set the importance to something fairly low, so that // anything else will be preferable. SetCurImportance( 8 ); } break; // Unexpected StateStatus. default: AIASSERT(0, m_pAI->m_hObject, "CAIGoalUnconscious::HandleStateUnconscious: Unexpected State Status."); } }
void CAIGoalAbstractStimulated::OnLinkBroken( LTObjRefNotifier *pRef, HOBJECT hObj ) { if( &m_hStimulusSource == pRef || &m_hStimulusTarget == pRef ) SetCurImportance( 0.0f ); }
void CAIGoalAbstractTargeted::OnLinkBroken( LTObjRefNotifier *pRef, HOBJECT hObj ) { if( &m_hTarget == pRef ) SetCurImportance( 0.0f ); }