本文整理汇总了C++中CAI::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI::GetPosition方法的具体用法?C++ CAI::GetPosition怎么用?C++ CAI::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI
的用法示例。
在下文中一共展示了CAI::GetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeactivateGoal
void CAIGoalCircleFlamePot::DeactivateGoal()
{
super::DeactivateGoal();
// If:
// 1) The player is an enemy.
// 2) There is another AI very close by
// 3) That AI does not have a blitz task
// ...this AI should blitz the player. This is an anti-clumping measure.
HOBJECT hTarget = m_pAI->GetAIBlackBoard()->GetBBTargetObject();
bool bShouldBlitz = false;
if ( m_pAI->HasTarget( kTarget_Character )
&& IsPlayer( hTarget ) )
{
CAI::AIList::const_iterator itEachAI = CAI::GetAIList().begin();
CAI::AIList::const_iterator itLastAI = CAI::GetAIList().end();
for ( ; itEachAI != itLastAI; ++itEachAI )
{
CAI* pCurrentAI = *itEachAI;
// Ignore NULL, self and dead AI.
if ( NULL == pCurrentAI
|| pCurrentAI == m_pAI
|| IsDeadAI( pCurrentAI->GetHOBJECT() ) )
{
continue;
}
// Ignore AIs who are far away in 2D (false positives are okay).
LTVector vDelta2D = ( pCurrentAI->GetPosition() - m_pAI->GetPosition() );
vDelta2D.y = 0.0f;
if ( vDelta2D.MagSqr() > g_flTooCloseToEnemySqr )
{
continue;
}
// Ignore AI who are already blitzing.
CAIWMFact factQuery;
factQuery.SetFactType( kFact_Task );
factQuery.SetTaskType( kTask_BlitzCharacter );
if ( pCurrentAI->GetAIWorkingMemory()->FindWMFact( factQuery ) )
{
continue;
}
// AI should blitz.
bShouldBlitz = true;
break;
}
}
if ( bShouldBlitz || ( 0 == GetRandom( 0, 2 ) ) )
{
CAIWMFact factQuery;
factQuery.SetFactType( kFact_Task );
factQuery.SetTaskType( kTask_BlitzCharacter );
CAIWMFact* pFact = m_pAI->GetAIWorkingMemory()->CreateWMFact( kFact_Task );
if ( pFact )
{
pFact->SetTaskType( kTask_BlitzCharacter );
pFact->SetTargetObject( hTarget );
pFact->SetIndex( kContext_None );
pFact->SetFactFlags( kFactFlag_Scripted, 1.f );
}
}
}