本文整理汇总了C++中CAI_BaseNPC::RemoveSpawnFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::RemoveSpawnFlags方法的具体用法?C++ CAI_BaseNPC::RemoveSpawnFlags怎么用?C++ CAI_BaseNPC::RemoveSpawnFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_BaseNPC
的用法示例。
在下文中一共展示了CAI_BaseNPC::RemoveSpawnFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeNPCInRadius
//-----------------------------------------------------------------------------
// Purpose: Place NPC somewhere on the perimeter of my radius.
//-----------------------------------------------------------------------------
void CTemplateNPCMaker::MakeNPCInRadius( void )
{
if ( !CanMakeNPC(true))
return;
CAI_BaseNPC *pent = NULL;
CBaseEntity *pEntity = NULL;
MapEntity_ParseEntity( pEntity, STRING(m_iszTemplateData), NULL );
if ( pEntity != NULL )
{
pent = (CAI_BaseNPC *)pEntity;
}
if ( !pent )
{
Warning("NULL Ent in NPCMaker!\n" );
return;
}
if ( !PlaceNPCInRadius( pent ) )
{
// Failed to place the NPC. Abort
UTIL_RemoveImmediate( pent );
return;
}
m_OnSpawnNPC.Set( pEntity, pEntity, this );
pent->AddSpawnFlags( SF_NPC_FALL_TO_GROUND );
pent->RemoveSpawnFlags( SF_NPC_TEMPLATE );
ChildPreSpawn( pent );
DispatchSpawn( pent );
pent->SetOwnerEntity( this );
DispatchActivate( pent );
ChildPostSpawn( pent );
m_nLiveChildren++;// count this NPC
if (!(m_spawnflags & SF_NPCMAKER_INF_CHILD))
{
m_nMaxNumNPCs--;
if ( IsDepleted() )
{
m_OnAllSpawned.FireOutput( this, this );
// Disable this forever. Don't kill it because it still gets death notices
SetThink( NULL );
SetUse( NULL );
}
}
}
示例2: MakeNPC
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTemplateNPCMaker::MakeNPC( void )
{
// If we should be using the radius spawn method instead, do so
if ( m_flRadius && HasSpawnFlags(SF_NPCMAKER_ALWAYSUSERADIUS) )
{
MakeNPCInRadius();
return;
}
if (!CanMakeNPC( ( m_iszDestinationGroup != NULL_STRING ) ))
return;
CNPCSpawnDestination *pDestination = NULL;
if ( m_iszDestinationGroup != NULL_STRING )
{
pDestination = FindSpawnDestination();
if ( !pDestination )
{
DevMsg( 2, "%s '%s' failed to find a valid spawnpoint in destination group: '%s'\n", GetClassname(), STRING(GetEntityName()), STRING(m_iszDestinationGroup) );
return;
}
}
CAI_BaseNPC *pent = NULL;
CBaseEntity *pEntity = NULL;
MapEntity_ParseEntity( pEntity, STRING(m_iszTemplateData), NULL );
if ( pEntity != NULL )
{
pent = (CAI_BaseNPC *)pEntity;
}
if ( !pent )
{
Warning("NULL Ent in NPCMaker!\n" );
return;
}
if ( pDestination )
{
pent->SetAbsOrigin( pDestination->GetAbsOrigin() );
// Strip pitch and roll from the spawner's angles. Pass only yaw to the spawned NPC.
QAngle angles = pDestination->GetAbsAngles();
angles.x = 0.0;
angles.z = 0.0;
pent->SetAbsAngles( angles );
pDestination->OnSpawnedNPC( pent );
}
else
{
pent->SetAbsOrigin( GetAbsOrigin() );
// Strip pitch and roll from the spawner's angles. Pass only yaw to the spawned NPC.
QAngle angles = GetAbsAngles();
angles.x = 0.0;
angles.z = 0.0;
pent->SetAbsAngles( angles );
}
m_OnSpawnNPC.Set( pEntity, pEntity, this );
if ( m_spawnflags & SF_NPCMAKER_FADE )
{
pent->AddSpawnFlags( SF_NPC_FADE_CORPSE );
}
pent->RemoveSpawnFlags( SF_NPC_TEMPLATE );
if ( ( m_spawnflags & SF_NPCMAKER_NO_DROP ) == false )
{
pent->RemoveSpawnFlags( SF_NPC_FALL_TO_GROUND ); // don't fall, slam
}
ChildPreSpawn( pent );
DispatchSpawn( pent );
pent->SetOwnerEntity( this );
DispatchActivate( pent );
ChildPostSpawn( pent );
m_nLiveChildren++;// count this NPC
if (!(m_spawnflags & SF_NPCMAKER_INF_CHILD))
{
m_nMaxNumNPCs--;
if ( IsDepleted() )
{
m_OnAllSpawned.FireOutput( this, this );
// Disable this forever. Don't kill it because it still gets death notices
SetThink( NULL );
SetUse( NULL );
}
}
//.........这里部分代码省略.........