本文整理汇总了C++中CBaseEntity::ClassMatches方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseEntity::ClassMatches方法的具体用法?C++ CBaseEntity::ClassMatches怎么用?C++ CBaseEntity::ClassMatches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseEntity
的用法示例。
在下文中一共展示了CBaseEntity::ClassMatches方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FireGameEvent_Internal
void FireGameEvent_Internal( IGameEvent *event )
{
if ( 0 == Q_strcmp( event->GetName(), "flare_ignite_npc" ) )
{
CBaseEntity *pEntityIgnited = UTIL_EntityByIndex( event->GetInt( "entindex" ) );
// was it a zombie that got set on fire?
if ( pEntityIgnited &&
( ( pEntityIgnited->ClassMatches( "npc_zombie" ) ) || ( pEntityIgnited->ClassMatches( "npc_zombine" ) ) ||
( pEntityIgnited->ClassMatches( "npc_fastzombie" ) ) || ( pEntityIgnited->ClassMatches( "npc_poisonzombie" ) ) ) )
{
IncrementCount();
}
}
}
示例2: CanSelectSchedule
//-----------------------------------------------------------------------------
// Purpose:
// Output : Returns true on success, false on failure.
// Notes : This behavior runs when I have an enemy that I fear, but who
// does NOT hate or fear me (meaning they aren't going to fight me)
//-----------------------------------------------------------------------------
bool CAI_FearBehavior::CanSelectSchedule()
{
if( !GetOuter()->IsInterruptable() )
return false;
if( m_flDeferUntil > gpGlobals->curtime )
return false;
CBaseEntity *pEnemy = GetEnemy();
if( pEnemy == NULL )
return false;
//if( !HasCondition(COND_SEE_PLAYER) )
// return false;
if( !ai_enable_fear_behavior.GetBool() )
return false;
if( GetOuter()->IRelationType(pEnemy) != D_FR )
return false;
if( !pEnemy->ClassMatches("npc_hunter") )
return false;
return true;
}
示例3: ShouldHitEntity
virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
{
static const char *ppszIgnoredClasses[] =
{
"weapon_*",
"item_*",
"prop_ragdoll",
"prop_dynamic",
"prop_static",
"prop_physics",
"npc_bullseye", // Tracker 15335
};
CBaseEntity *pEntity = EntityFromEntityHandle( pServerEntity );
// Tracker 15335: Never impact decals against entities which are not rendering, either.
if ( pEntity->IsEffectActive( EF_NODRAW ) )
return false;
for ( int i = 0; i < ARRAYSIZE(ppszIgnoredClasses); i++ )
{
if ( pEntity->ClassMatches( ppszIgnoredClasses[i] ) )
return false;
}
if ( modelinfo->GetModelType( pEntity->GetModel() ) != mod_brush )
return false;
return CTraceFilterSimple::ShouldHitEntity( pServerEntity, contentsMask );
}
示例4: GetEntInfoPtr
//-----------------------------------------------------------------------------
// Purpose: Iterates the entities with a given classname.
// Input : pStartEntity - Last entity found, NULL to start a new iteration.
// szName - Classname to search for.
//-----------------------------------------------------------------------------
CBaseEntity *CGlobalEntityList::FindEntityByClassname( CBaseEntity *pStartEntity, const char *szName )
{
const CEntInfo *pInfo = pStartEntity ? GetEntInfoPtr( pStartEntity->GetRefEHandle() )->m_pNext : FirstEntInfo();
for ( ;pInfo; pInfo = pInfo->m_pNext )
{
CBaseEntity *pEntity = (CBaseEntity *)pInfo->m_pEntity;
if ( !pEntity )
{
DevWarning( "NULL entity in global entity list!\n" );
continue;
}
if ( pEntity->ClassMatches(szName) )
return pEntity;
}
return NULL;
}
示例5: ShouldHitEntity
//-----------------------------------------------------------------------------
bool CTraceFilterNav::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask )
{
IServerEntity *pServerEntity = (IServerEntity*)pHandleEntity;
CBaseEntity *pEntity = (CBaseEntity *)pServerEntity;
if ( m_pProber == pEntity )
return false;
if ( m_pProber->GetMoveProbe()->ShouldBrushBeIgnored( pEntity ) == true )
return false;
#ifdef HL1_DLL
if ( ( contentsMask & CONTENTS_MOVEABLE ) == 0 )
{
if ( pEntity->ClassMatches( "func_pushable" ) )
return false;
}
#endif
if ( m_bIgnoreTransientEntities && (pEntity->IsPlayer() || pEntity->IsNPC() ) )
return false;
//Adrian - If I'm flagged as using the new collision method, then ignore the player when trying
//to check if I can get somewhere.
if ( m_pProber->ShouldPlayerAvoid() && pEntity->IsPlayer() )
return false;
if ( pEntity->IsNavIgnored() )
return false;
if ( m_bCheckCollisionTable )
{
if ( g_EntityCollisionHash->IsObjectPairInHash( m_pProber, pEntity ) )
return false;
}
if ( m_pProber->ShouldProbeCollideAgainstEntity( pEntity ) == false )
return false;
return CTraceFilterSimple::ShouldHitEntity( pHandleEntity, contentsMask );
}
示例6: DynamicResupply_InitFromAlternateMaster
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void DynamicResupply_InitFromAlternateMaster( CBaseEntity *pTargetEnt, string_t iszMaster )
{
if ( iszMaster== NULL_STRING )
{
return;
}
CItem_DynamicResupply *pTargetResupply = assert_cast<CItem_DynamicResupply *>( pTargetEnt );
CBaseEntity *pMasterEnt = gEntList.FindEntityByName( NULL, iszMaster );
if ( !pMasterEnt || !pMasterEnt->ClassMatches( pTargetResupply->GetClassname() ) )
{
DevWarning( "Invalid item_dynamic_resupply name %s\n", STRING( iszMaster ) );
return;
}
CItem_DynamicResupply *pMasterResupply = assert_cast<CItem_DynamicResupply *>( pMasterEnt );
pTargetResupply->RemoveSpawnFlags( SF_DYNAMICRESUPPLY_USE_MASTER );
memcpy( pTargetResupply->m_flDesiredHealth, pMasterResupply->m_flDesiredHealth, sizeof( pMasterResupply->m_flDesiredHealth ) );
memcpy( pTargetResupply->m_flDesiredAmmo, pMasterResupply->m_flDesiredAmmo, sizeof( pMasterResupply->m_flDesiredAmmo ) );
}
示例7: saveZonFile
static void saveZonFile(const char* szMapName)
{
KeyValues* zoneKV = new KeyValues(szMapName);
CBaseEntity* pEnt = gEntList.FindEntityByClassname(NULL, "trigger_momentum_*");
while (pEnt)
{
KeyValues* subKey = NULL;
if (pEnt->ClassMatches("trigger_momentum_timer_start"))
{
CTriggerTimerStart* pTrigger = dynamic_cast<CTriggerTimerStart*>(pEnt);
subKey = new KeyValues("start");
if (pTrigger)
{
subKey->SetFloat("leavespeed", pTrigger->GetMaxLeaveSpeed());
subKey->SetBool("limitingspeed", pTrigger->IsLimitingSpeed());
}
}
else if (pEnt->ClassMatches("trigger_momentum_timer_stop"))
{
subKey = new KeyValues("end");
}
else if (pEnt->ClassMatches("trigger_momentum_timer_checkpoint"))
{
CTriggerCheckpoint* pTrigger = dynamic_cast<CTriggerCheckpoint*>(pEnt);
if (pTrigger)
{
subKey = new KeyValues("checkpoint");
subKey->SetInt("number", pTrigger->GetCheckpointNumber());
}
}
else if (pEnt->ClassMatches("trigger_momentum_onehop"))
{
CTriggerOnehop* pTrigger = dynamic_cast<CTriggerOnehop*>(pEnt);
if (pTrigger)
{
subKey = new KeyValues("onehop");
//subKey->SetInt("destination", pTrigger->GetDestinationIndex());
subKey->SetBool("stop", pTrigger->ShouldStopPlayer());
subKey->SetBool("resetang", pTrigger->ShouldResetAngles());
subKey->SetFloat("hold", pTrigger->GetHoldTeleportTime());
subKey->SetString("destinationname", pTrigger->m_target.ToCStr());
}
}
else if (pEnt->ClassMatches("trigger_momentum_resetonehop"))
{
subKey = new KeyValues("resetonehop");
}
else if (pEnt->ClassMatches("trigger_momentum_teleport_checkpoint"))
{
CTriggerTeleportCheckpoint* pTrigger = dynamic_cast<CTriggerTeleportCheckpoint*>(pEnt);
if (pTrigger)
{
subKey = new KeyValues("checkpoint_teleport");
//subKey->SetInt("destination", pTrigger->GetDestinationCheckpointNumber());
subKey->SetBool("stop", pTrigger->ShouldStopPlayer());
subKey->SetBool("resetang", pTrigger->ShouldResetAngles());
subKey->SetString("destinationname", pTrigger->m_target.ToCStr());
}
}
else if (pEnt->ClassMatches("trigger_momentum_multihop"))
{
CTriggerMultihop* pTrigger = dynamic_cast<CTriggerMultihop*>(pEnt);
if (pTrigger)
{
subKey = new KeyValues("multihop");
//subKey->SetInt("destination", pTrigger->GetDestinationIndex());
subKey->SetBool("stop", pTrigger->ShouldStopPlayer());
subKey->SetFloat("hold", pTrigger->GetHoldTeleportTime());
subKey->SetBool("resetang", pTrigger->ShouldResetAngles());
subKey->SetString("destinationname", pTrigger->m_target.ToCStr());
}
}
else if (pEnt->ClassMatches("trigger_momentum_timer_stage"))
{
CTriggerStage *pTrigger = dynamic_cast<CTriggerStage*>(pEnt);
if (pTrigger)
{
subKey = new KeyValues("stage");
subKey->SetInt("number", pTrigger->GetStageNumber());
}
}
if (subKey)
{
subKey->SetFloat("xPos", pEnt->GetAbsOrigin().x);
subKey->SetFloat("yPos", pEnt->GetAbsOrigin().y);
subKey->SetFloat("zPos", pEnt->GetAbsOrigin().z);
subKey->SetFloat("xRot", pEnt->GetAbsAngles().x);
subKey->SetFloat("yRot", pEnt->GetAbsAngles().y);
subKey->SetFloat("zRot", pEnt->GetAbsAngles().z);
subKey->SetFloat("xScaleMins", pEnt->WorldAlignMins().x);
subKey->SetFloat("yScaleMins", pEnt->WorldAlignMins().y);
subKey->SetFloat("zScaleMins", pEnt->WorldAlignMins().z);
subKey->SetFloat("xScaleMaxs", pEnt->WorldAlignMaxs().x);
subKey->SetFloat("yScaleMaxs", pEnt->WorldAlignMaxs().y);
subKey->SetFloat("zScaleMaxs", pEnt->WorldAlignMaxs().z);
zoneKV->AddSubKey(subKey);
}
pEnt = gEntList.FindEntityByClassname(pEnt, "trigger_momentum_*");
}
//.........这里部分代码省略.........