本文整理汇总了C++中CBaseCombatCharacter::RemoveEntityRelationship方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseCombatCharacter::RemoveEntityRelationship方法的具体用法?C++ CBaseCombatCharacter::RemoveEntityRelationship怎么用?C++ CBaseCombatCharacter::RemoveEntityRelationship使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseCombatCharacter
的用法示例。
在下文中一共展示了CBaseCombatCharacter::RemoveEntityRelationship方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChangeRelationships
//.........这里部分代码省略.........
// Search NPCs
for ( int i = 0; i < g_AI_Manager.NumAIs(); i++ )
{
if ( subjectList.Count() == MAX_HANDLED || targetList.Count() == MAX_HANDLED )
{
DevMsg( "Too many entities handled by ai_relationship %s\n", GetDebugName() );
break;
}
CAI_BaseNPC *pNPC = (g_AI_Manager.AccessAIs())[i];
if ( pNPC )
{
if( IsASubject( pNPC ) )
{
if ( m_flRadius == 0.0 || GetAbsOrigin().DistToSqr( pNPC->GetAbsOrigin() ) <= radiusSq )
subjectList.AddToTail( pNPC );
}
else if( IsATarget( pNPC ) )
{
targetList.AddToTail( pNPC );
}
}
}
// If either list is still empty, we have a problem.
if( subjectList.Count() == 0 )
{
DevMsg( 2, "ai_relationship '%s' finds no subject(s) called: %s\n", GetDebugName(), STRING( m_iszSubject ) );
return;
}
else if ( targetList.Count() == 0 )
{
DevMsg( 2, "ai_relationship '%s' finds no target(s) called: %s\n", GetDebugName(), STRING( m_target ) );
return;
}
// Ok, lists are populated. Apply all relationships.
for ( int i = 0 ; i < subjectList.Count(); i++ )
{
CBaseCombatCharacter *pSubject = subjectList[ i ];
for ( int j = 0 ; j < targetList.Count(); j++ )
{
CBaseCombatCharacter *pTarget = targetList[ j ];
if ( m_iPreviousDisposition == -1 && iReverting == NOT_REVERTING )
{
// Set previous disposition.
m_iPreviousDisposition = pSubject->IRelationType( pTarget );
m_iPreviousRank = pSubject->IRelationPriority( pTarget );
}
if ( iReverting == REVERTING_TO_PREV )
{
pSubject->AddEntityRelationship( pTarget, (Disposition_t)m_iPreviousDisposition, m_iPreviousRank );
if( m_bReciprocal )
{
pTarget->AddEntityRelationship( pSubject, (Disposition_t)m_iPreviousDisposition, m_iPreviousRank );
}
}
else if ( iReverting == REVERTING_TO_DEFAULT )
{
pSubject->RemoveEntityRelationship( pTarget );
if( m_bReciprocal )
{
pTarget->RemoveEntityRelationship( pSubject );
}
}
else if( pSubject->IRelationType(pTarget) != disposition ||
pSubject->IRelationPriority(pTarget) != m_iRank ||
HasSpawnFlags( SF_RELATIONSHIP_NOTIFY_SUBJECT ) ||
HasSpawnFlags( SF_RELATIONSHIP_NOTIFY_TARGET ) )
{
// Apply the relationship to the subject
pSubject->AddEntityRelationship( pTarget, (Disposition_t)disposition, m_iRank );
// Make the subject aware of the target
if ( HasSpawnFlags( SF_RELATIONSHIP_NOTIFY_SUBJECT ) )
{
DiscloseNPCLocation( pSubject, pTarget );
}
// Make the target aware of the subject
if ( HasSpawnFlags( SF_RELATIONSHIP_NOTIFY_TARGET ) )
{
DiscloseNPCLocation( pTarget, pSubject );
}
// This relationship is applied to target and subject alike
if ( m_bReciprocal )
{
// Apply the relationship to the target
pTarget->AddEntityRelationship( pSubject, (Disposition_t)disposition, m_iRank );
}
}
}
}
}