本文整理汇总了C++中CAI_BaseNPC::GetSquad方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::GetSquad方法的具体用法?C++ CAI_BaseNPC::GetSquad怎么用?C++ CAI_BaseNPC::GetSquad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_BaseNPC
的用法示例。
在下文中一共展示了CAI_BaseNPC::GetSquad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SquadIsMember
//-------------------------------------
// Purpose: Returns true if given entity is in the squad
//-------------------------------------
bool CAI_Squad::SquadIsMember( CBaseEntity *pMember )
{
CAI_BaseNPC *pNPC = pMember->MyNPCPointer();
if ( pNPC && pNPC->GetSquad() == this )
return true;
return false;
}
示例2: PassesMobbedFilter
//-----------------------------------------------------------------------------
// Purpose: Attempt to govern how many squad members can target any given entity
// Input : *pCaller - Entity assessing the target
// *pEnemy - Entity being assessed
// Output : Returns true if potential enemy passes this filter stage
//-----------------------------------------------------------------------------
bool CFilterEnemy::PassesMobbedFilter( CBaseEntity *pCaller, CBaseEntity *pEnemy )
{
// Must be a valid candidate
CAI_BaseNPC *pNPC = pCaller->MyNPCPointer();
if ( pNPC == NULL || pNPC->GetSquad() == NULL )
return true;
// Make sure we're checking for this
if ( m_nMaxSquadmatesPerEnemy <= 0 )
return true;
AISquadIter_t iter;
int nNumMatchingSquadmates = 0;
// Look through our squad members to see how many of them are already mobbing this entity
for ( CAI_BaseNPC *pSquadMember = pNPC->GetSquad()->GetFirstMember( &iter ); pSquadMember != NULL; pSquadMember = pNPC->GetSquad()->GetNextMember( &iter ) )
{
// Disregard ourself
if ( pSquadMember == pNPC )
continue;
// If the enemies match, count it
if ( pSquadMember->GetEnemy() == pEnemy )
{
nNumMatchingSquadmates++;
// If we're at or passed the max we stop
if ( nNumMatchingSquadmates >= m_nMaxSquadmatesPerEnemy )
{
// We wanted to find more than allowed and we did
if ( m_bNegated )
return true;
// We wanted to be less but we're not
return false;
}
}
}
// We wanted to find more than the allowed amount but we didn't
if ( m_bNegated )
return false;
return true;
}