本文整理汇总了C++中CAI_BaseNPC::SetPrimaryBehavior方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::SetPrimaryBehavior方法的具体用法?C++ CAI_BaseNPC::SetPrimaryBehavior怎么用?C++ CAI_BaseNPC::SetPrimaryBehavior使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_BaseNPC
的用法示例。
在下文中一共展示了CAI_BaseNPC::SetPrimaryBehavior方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ForceSelectedGoRandom
//-----------------------------------------------------------------------------
// Purpose: Static debug function to make all selected npcs run around
// Input :
// Output :
//-----------------------------------------------------------------------------
void CAI_BaseNPC::ForceSelectedGoRandom(void)
{
CAI_BaseNPC *npc = gEntList.NextEntByClass( (CAI_BaseNPC *)NULL );
while (npc)
{
if (npc->m_debugOverlays & OVERLAY_NPC_SELECTED_BIT)
{
// If a behavior is active, we need to stop running it
npc->SetPrimaryBehavior( NULL );
npc->SetSchedule( SCHED_RUN_RANDOM );
npc->GetNavigator()->SetMovementActivity(ACT_RUN);
}
npc = gEntList.NextEntByClass(npc);
}
}
示例2: ForceSelectedGo
//-----------------------------------------------------------------------------
// Purpose: Static debug function to force all selected npcs to go to the
// given node
// Input :
// Output :
//-----------------------------------------------------------------------------
void CAI_BaseNPC::ForceSelectedGo(CBaseEntity *pPlayer, const Vector &targetPos, const Vector &traceDir, bool bRun)
{
CAI_BaseNPC *npc = gEntList.NextEntByClass( (CAI_BaseNPC *)NULL );
for ( ; npc; npc = gEntList.NextEntByClass(npc) )
{
if ( ( npc->m_debugOverlays & OVERLAY_NPC_SELECTED_BIT ) == 0 )
continue;
// If a behavior is active, we need to stop running it
npc->SetPrimaryBehavior( NULL );
Vector chasePosition = targetPos;
npc->TranslateNavGoal( pPlayer, chasePosition );
// It it legal to drop me here
Vector vUpBit = chasePosition;
vUpBit.z += 1;
trace_t tr;
AI_TraceHull( chasePosition, vUpBit, npc->GetHullMins(),
npc->GetHullMaxs(), npc->GetAITraceMask(), npc, COLLISION_GROUP_NONE, &tr );
if (tr.startsolid || tr.fraction != 1.0 )
{
NDebugOverlay::BoxAngles(chasePosition, npc->GetHullMins(),
npc->GetHullMaxs(), npc->GetAbsAngles(), 255,0,0,20,0.5);
}
npc->m_vecLastPosition = chasePosition;
if (npc->m_hCine != NULL)
{
npc->ExitScriptedSequence();
}
npc->SetSchedule( bRun ? SCHED_FORCED_GO_RUN : SCHED_FORCED_GO );
npc->m_flMoveWaitFinished = gpGlobals->curtime;
}
}