本文整理汇总了C++中CGib::edict方法的典型用法代码示例。如果您正苦于以下问题:C++ CGib::edict方法的具体用法?C++ CGib::edict怎么用?C++ CGib::edict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGib
的用法示例。
在下文中一共展示了CGib::edict方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpawnHeadGib
void CGib::SpawnHeadGib(entvars_t *pevVictim)
{
CGib *pGib = GetClassPtr<CCSGib>((CGib *)NULL);
if (g_Language == LANGUAGE_GERMAN)
{
// throw one head
pGib->Spawn("models/germangibs.mdl");
pGib->pev->body = 0;
}
else
{
// throw one head
pGib->Spawn("models/hgibs.mdl");
pGib->pev->body = 0;
}
if (pevVictim)
{
pGib->pev->origin = pevVictim->origin + pevVictim->view_ofs;
edict_t *pentPlayer = FIND_CLIENT_IN_PVS(pGib->edict());
if (RANDOM_LONG(0, 100) <= 5 && pentPlayer != NULL)
{
// 5% chance head will be thrown at player's face.
entvars_t *pevPlayer = VARS(pentPlayer);
pGib->pev->velocity = ((pevPlayer->origin + pevPlayer->view_ofs) - pGib->pev->origin).Normalize() * 300;
pGib->pev->velocity.z += 100;
}
else
{
// TODO: fix test demo
pGib->pev->velocity.z = RANDOM_FLOAT(200, 300);
pGib->pev->velocity.y = RANDOM_FLOAT(-100, 100);
pGib->pev->velocity.x = RANDOM_FLOAT(-100, 100);
}
pGib->pev->avelocity.x = RANDOM_FLOAT(100, 200);
pGib->pev->avelocity.y = RANDOM_FLOAT(100, 300);
// copy owner's blood color
pGib->m_bloodColor = (CBaseEntity::Instance(pevVictim))->BloodColor();
if (pevVictim->health > -50)
{
pGib->pev->velocity = pGib->pev->velocity * 0.7;
}
else if (pevVictim->health > -200)
{
pGib->pev->velocity = pGib->pev->velocity * 2;
}
else
pGib->pev->velocity = pGib->pev->velocity * 4;
}
pGib->LimitVelocity();
}
示例2: SpawnHeadGib
void CGib::SpawnHeadGib( CBaseEntity *pVictim )
{
CGib *pGib = CREATE_ENTITY( CGib, "gib" );
//City17: Germany Violence Fix.
/*if ( g_Language.GetInt() == LANGUAGE_GERMAN )
{
pGib->Spawn( "models/germangibs.mdl" );// throw one head
pGib->m_nBody = 0;
}
else
{*/
pGib->Spawn( "models/gibs/hgibs.mdl" );// throw one head
pGib->m_nBody = 0;
//}
if ( pVictim )
{
Vector vecNewVelocity = pGib->GetAbsVelocity();
pGib->SetLocalOrigin( pVictim->EyePosition() );
edict_t *pentPlayer = UTIL_FindClientInPVS( pGib->edict() );
if ( random->RandomInt ( 0, 100 ) <= 5 && pentPlayer )
{
// 5% chance head will be thrown at player's face.
CBasePlayer *player = (CBasePlayer *)CBaseEntity::Instance( pentPlayer );
if ( player )
{
vecNewVelocity = ( player->EyePosition() ) - pGib->GetAbsOrigin();
VectorNormalize(vecNewVelocity);
vecNewVelocity *= 300;
vecNewVelocity.z += 100;
}
}
else
{
vecNewVelocity = Vector (random->RandomFloat(-100,100), random->RandomFloat(-100,100), random->RandomFloat(200,300));
}
QAngle vecNewAngularVelocity = pGib->GetLocalAngularVelocity();
vecNewAngularVelocity.x = random->RandomFloat ( 100, 200 );
vecNewAngularVelocity.y = random->RandomFloat ( 100, 300 );
pGib->SetLocalAngularVelocity( vecNewAngularVelocity );
// copy owner's blood color
pGib->SetBloodColor( pVictim->BloodColor() );
pGib->AdjustVelocityBasedOnHealth( pVictim->m_iHealth, vecNewVelocity );
pGib->SetAbsVelocity( vecNewVelocity );
}
pGib->LimitVelocity();
}
示例3: if
void CGib :: SpawnHeadGib( entvars_t *pevVictim, const char* szGibModel )
{
CGib *pGib = GetClassPtr( (CGib *)NULL );
pGib->Spawn( szGibModel );// throw one head
pGib->pev->body = 0;
if ( pevVictim )
{
pGib->pev->origin = pevVictim->origin + pevVictim->view_ofs;
edict_t *pentPlayer = FIND_CLIENT_IN_PVS( pGib->edict() );
if ( RANDOM_LONG ( 0, 100 ) <= 5 && pentPlayer )
{
// 5% chance head will be thrown at player's face.
entvars_t *pevPlayer;
pevPlayer = VARS( pentPlayer );
pGib->pev->velocity = ( ( pevPlayer->origin + pevPlayer->view_ofs ) - pGib->pev->origin ).Normalize() * 300;
pGib->pev->velocity.z += 100;
}
else
{
pGib->pev->velocity = Vector (RANDOM_FLOAT(-100,100), RANDOM_FLOAT(-100,100), RANDOM_FLOAT(200,300));
}
pGib->pev->avelocity.x = RANDOM_FLOAT ( 100, 200 );
pGib->pev->avelocity.y = RANDOM_FLOAT ( 100, 300 );
// copy owner's blood color
pGib->m_bloodColor = (CBaseEntity::Instance(pevVictim))->BloodColor();
if ( pevVictim->health > -50)
{
pGib->pev->velocity = pGib->pev->velocity * 0.7;
}
else if ( pevVictim->health > -200)
{
pGib->pev->velocity = pGib->pev->velocity * 2;
}
else
{
pGib->pev->velocity = pGib->pev->velocity * 4;
}
}
pGib->LimitVelocity();
}
示例4: SpawnHeadGib
void CGib :: SpawnHeadGib( entvars_t *pevVictim )
{
CGib *pGib = GetClassPtr( (CGib *)NULL );
if ( g_Language == LANGUAGE_GERMAN )
{
pGib->Spawn( "models/germangibs.mdl" );// throw one head
pGib->pev->body = 0;
}
else
{
pGib->Spawn( "models/head.mdl" );// throw one head
}
if ( pevVictim )
{
pGib->pev->origin = pevVictim->origin + pevVictim->view_ofs;
edict_t *pentPlayer = FIND_CLIENT_IN_PVS( pGib->edict() );
pGib->pev->velocity = Vector (RANDOM_FLOAT(-100,100), RANDOM_FLOAT(-100,100), RANDOM_FLOAT(300,400));
pGib->pev->avelocity.x = RANDOM_FLOAT ( 100, 200 );
pGib->pev->avelocity.y = RANDOM_FLOAT ( 100, 300 );
// copy owner's blood color
pGib->m_bloodColor = (CBaseEntity::Instance(pevVictim))->BloodColor();
// Set its groupinfo to the player's
pGib->pev->groupinfo = pevVictim->groupinfo;
// Since this only ever happens when a player is hit by a frozen decapitator disc, make the gibs glow
pGib->pev->renderfx = kRenderFxGlowShell;
pGib->pev->rendercolor = Vector( 100,100, 250 );
pGib->pev->renderamt = 25;
}
pGib->LimitVelocity();
}