本文整理汇总了C++中CBaseMonster::edict方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseMonster::edict方法的具体用法?C++ CBaseMonster::edict怎么用?C++ CBaseMonster::edict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseMonster
的用法示例。
在下文中一共展示了CBaseMonster::edict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Activate
// Find an entity that I'm interested in and precache the sounds he'll need in the sequence.
void CCineMonster::Activate(void)
{
edict_t * pentTarget;
CBaseMonster *pTarget;
// The entity name could be a target name or a classname
// Check the targetname
pentTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(m_iszEntity));
pTarget = NULL;
while(!pTarget && !FNullEnt(pentTarget))
{
if(FBitSet(VARS(pentTarget)->flags, FL_MONSTER))
{
pTarget = GetMonsterPointer(pentTarget);
}
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
}
// If no entity with that targetname, check the classname
if(!pTarget)
{
pentTarget = FIND_ENTITY_BY_CLASSNAME(NULL, STRING(m_iszEntity));
while(!pTarget && !FNullEnt(pentTarget))
{
pTarget = GetMonsterPointer(pentTarget);
pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(m_iszEntity));
}
}
// Found a compatible entity
if(pTarget)
{
void *pmodel;
pmodel = GET_MODEL_PTR(pTarget->edict());
if(pmodel)
{
// Look through the event list for stuff to precache
SequencePrecache(pmodel, STRING(m_iszIdle));
SequencePrecache(pmodel, STRING(m_iszPlay));
}
}
}
示例2: MakeGrunt
CBaseMonster *COsprey :: MakeGrunt( Vector vecSrc )
{
CBaseEntity *pEntity;
CBaseMonster *pGrunt;
TraceResult tr;
UTIL_TraceLine( vecSrc, vecSrc + Vector( 0, 0, -4096.0), dont_ignore_monsters, ENT(pev), &tr);
if ( tr.pHit && Instance( tr.pHit )->pev->solid != SOLID_BSP)
return NULL;
for (int i = 0; i < m_iUnits; i++)
{
if (m_hGrunt[i] == NULL || !m_hGrunt[i]->IsAlive())
{
if (m_hGrunt[i] != NULL && m_hGrunt[i]->pev->rendermode == kRenderNormal)
{
m_hGrunt[i]->SUB_StartFadeOut( );
}
pEntity = Create( "monster_human_grunt", vecSrc, pev->angles );
pGrunt = pEntity->MyMonsterPointer( );
pGrunt->pev->movetype = MOVETYPE_FLY;
pGrunt->pev->velocity = Vector( 0, 0, RANDOM_FLOAT( -196, -128 ) );
pGrunt->SetActivity( ACT_GLIDE );
CBeam *pBeam = CBeam::BeamCreate( "sprites/rope.spr", 10 );
pBeam->PointEntInit( vecSrc + Vector(0,0,112), pGrunt->edict() );
pBeam->SetFlags( FBEAM_SOLID );
pBeam->SetColor( 255, 255, 255 );
pBeam->SetThink(&CBeam:: SUB_Remove );
pBeam->SetNextThink( -4096.0 * tr.flFraction / pGrunt->pev->velocity.z + 0.5 );
// ALERT( at_console, "%d at %.0f %.0f %.0f\n", i, m_vecOrigin[i].x, m_vecOrigin[i].y, m_vecOrigin[i].z );
pGrunt->m_vecLastPosition = m_vecOrigin[i];
m_hGrunt[i] = pGrunt;
return pGrunt;
}
}
// ALERT( at_console, "none dead\n");
return NULL;
}
示例3: Activate
// Find an entity that I'm interested in and precache the sounds he'll need in the sequence.
void CCineMonster::Activate( void )
{
CBaseMonster* pTarget = nullptr;
CBaseEntity* pNextTarget = nullptr;
// The entity name could be a target name or a classname
// Check the targetname
while( !pTarget && ( pNextTarget = UTIL_FindEntityByTargetname( pNextTarget, STRING( m_iszEntity ) ) ) != nullptr )
{
if( pNextTarget->GetFlags().Any( FL_MONSTER ) )
{
pTarget = pNextTarget->MyMonsterPointer();
}
}
// If no entity with that targetname, check the classname
if( !pTarget )
{
pNextTarget = nullptr;
while( !pTarget && ( pNextTarget = UTIL_FindEntityByClassname( pNextTarget, STRING( m_iszEntity ) ) ) != nullptr )
{
pTarget = pNextTarget->MyMonsterPointer();
}
}
// Found a compatible entity
if( pTarget )
{
void *pmodel;
pmodel = GET_MODEL_PTR( pTarget->edict() );
if( pmodel )
{
// Look through the event list for stuff to precache
SequencePrecache( pmodel, STRING( m_iszIdle ) );
SequencePrecache( pmodel, STRING( m_iszPlay ) );
}
}
}