本文整理汇总了C++中CAI_BaseNPC::SetSchedule方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::SetSchedule方法的具体用法?C++ CAI_BaseNPC::SetSchedule怎么用?C++ CAI_BaseNPC::SetSchedule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_BaseNPC
的用法示例。
在下文中一共展示了CAI_BaseNPC::SetSchedule方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: AlertFriends
void CAI_PlayerAlly::AlertFriends( CBaseEntity *pKiller )
{
CBaseEntity *pFriend = NULL;
int i;
// for each friend in this bsp...
for ( i = 0; i < TLK_CFRIENDS; i++ )
{
while (pFriend = EnumFriends( pFriend, i, true ))
{
CAI_BaseNPC *pNPC = pFriend->MyNPCPointer();
if ( pNPC->IsAlive() )
{
// If a client killed me, make everyone else mad/afraid of him
if ( pKiller->GetFlags() & FL_CLIENT )
{
pNPC->SetSchedule( SCHED_TALKER_BETRAYED );
#ifdef ALLIES_CAN_BE_PROVOKED
pNPC->Remember( bits_MEMORY_PROVOKED );
if( IsSelected() )
{
PlayerSelect( false );
}
#endif
}
else
{
if( IRelationType(pKiller) == D_HT)
{
// Killed by an enemy!!!
CAI_PlayerAlly *pAlly = (CAI_PlayerAlly *)pNPC;
if( pAlly && pAlly->GetExpresser()->CanSpeakConcept( TLK_ALLY_KILLED ) )
{
pAlly->Speak( TLK_ALLY_KILLED );
}
}
}
}
}
}
}
示例3: 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;
}
}