本文整理汇总了C++中CAI::GetAISensorMgr方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI::GetAISensorMgr方法的具体用法?C++ CAI::GetAISensorMgr怎么用?C++ CAI::GetAISensorMgr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI
的用法示例。
在下文中一共展示了CAI::GetAISensorMgr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAISensors
void CAIMgr::UpdateAISensors()
{
CTList<CCharacter*>* plstChars = g_pCharacterMgr->GetCharacterList( CCharacterMgr::kList_AIs );
CCharacter** pNext;
CAI* pCurAI;
// No AI exist.
if( plstChars->GetLength() == 0 )
{
return;
}
// Find the next AI to update.
// AI update round robin, so everyone gets the opportunity to
// do a distributed update.
pNext = plstChars->GetItem( TLIT_FIRST );
while( m_hNextAI && ( (*pNext)->m_hObject != m_hNextAI ) )
{
pNext = plstChars->GetItem( TLIT_NEXT );
}
if( !pNext )
{
pNext = plstChars->GetItem( TLIT_FIRST );
}
HOBJECT hFirstToUpdate = (*pNext)->m_hObject;
// Iterate over all existing AI.
bool bWrapped = false;
bool bUpdateDistributedSensors = true;
while( true )
{
// Bail once we have updated everyone.
if( bWrapped )
{
break;
}
// Look ahead at the next AI to update, and flag if we've wrapped.
pCurAI = (CAI*)*pNext;
pNext = plstChars->GetItem( TLIT_NEXT );
if( !pNext )
{
pNext = plstChars->GetItem( TLIT_FIRST );
}
if( (*pNext)->m_hObject == hFirstToUpdate )
{
bWrapped = true;
}
// Do not update sensors of dead AI.
if( pCurAI->GetDestructible()->IsDead() )
{
continue;
}
// Update all AI's sensors.
// Stop updating distributed sensors once someone has performed
// an expensive update.
if( pCurAI->GetAISensorMgr()->UpdateSensors( bUpdateDistributedSensors ) )
{
#if DISTRIBUTE_SENSORS
m_hNextAI = (*pNext)->m_hObject;
bUpdateDistributedSensors = false;
#endif
}
}
}