本文整理汇总了C++中CGrenade::Spawn方法的典型用法代码示例。如果您正苦于以下问题:C++ CGrenade::Spawn方法的具体用法?C++ CGrenade::Spawn怎么用?C++ CGrenade::Spawn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGrenade
的用法示例。
在下文中一共展示了CGrenade::Spawn方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetClassPtr
CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity )
{
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
pGrenade->Spawn();
// contact grenades arc lower
pGrenade->pev->gravity = 0.5;// lower gravity since grenade is aerodynamic and engine doesn't know it.
UTIL_SetOrigin( pGrenade->pev, vecStart );
pGrenade->pev->velocity = vecVelocity;
pGrenade->pev->angles = UTIL_VecToAngles (pGrenade->pev->velocity);
pGrenade->pev->owner = ENT(pevOwner);
// make monsters afaid of it while in the air
pGrenade->SetThink( &CGrenade::DangerSoundThink );
pGrenade->pev->nextthink = gpGlobals->time;
// Tumble in air
pGrenade->pev->avelocity.x = RANDOM_FLOAT ( -100, -500 );
// Explode on contact
pGrenade->SetTouch( &CGrenade::ExplodeTouch );
pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade;
return pGrenade;
}
示例2: GetClassPtr
CGrenade *CGrenade::ShootSmokeGrenade(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent)
{
CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL);
pGrenade->Spawn();
UTIL_SetOrigin(pGrenade->pev, vecStart);
pGrenade->pev->velocity = vecVelocity;
pGrenade->pev->angles = pevOwner->angles;
pGrenade->pev->owner = ENT(pevOwner);
pGrenade->m_usEvent = usEvent;
pGrenade->m_bLightSmoke = false;
pGrenade->m_bDetonated = false;
pGrenade->SetTouch(&CGrenade::BounceTouch);
pGrenade->pev->dmgtime = gpGlobals->time + time;
pGrenade->SetThink(&CGrenade::SG_TumbleThink);
pGrenade->pev->nextthink = gpGlobals->time + 0.1;
if (time < 0.1)
{
pGrenade->pev->nextthink = gpGlobals->time;
pGrenade->pev->velocity = Vector(0, 0, 0);
}
pGrenade->pev->sequence = RANDOM_LONG(3, 6);
pGrenade->pev->framerate = 1;
pGrenade->m_bJustBlew = true;
pGrenade->pev->gravity = 0.5;
pGrenade->pev->friction = 0.8;
pGrenade->m_SGSmoke = 0;
SET_MODEL(ENT(pGrenade->pev), "models/w_smokegrenade.mdl");
pGrenade->pev->dmg = 35;
return pGrenade;
}
示例3: GetClassPtr
CGrenade* CGrenade::ShootTimed2( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, int team, unsigned short usEvent )
{
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
pGrenade->Spawn();
UTIL_SetOrigin( pGrenade->pev, vecStart );
pGrenade->pev->velocity = vecVelocity;
pGrenade->pev->angles = pevOwner->angles;
pGrenade->pev->owner = ENT( pevOwner );
pGrenade->m_usEvent = usEvent;
pGrenade->SetTouch( &CGrenade::BounceTouch );
pGrenade->SetThink( &CGrenade::TumbleThink );
pGrenade->pev->dmgtime = gpGlobals->time + time;
pGrenade->pev->nextthink= gpGlobals->time + 0.1;
pGrenade->pev->sequence = RANDOM_LONG( 3, 6 );
pGrenade->pev->framerate= 1.0;
pGrenade->m_fJustBlew = TRUE;
pGrenade->m_iTeam = team;
pGrenade->pev->gravity = 0.55;
pGrenade->pev->friction = 0.70;
pGrenade->pev->dmg = 100;
SET_MODEL( ENT( pGrenade->pev ), "models/w_hegrenade.mdl" );
return pGrenade;
}
示例4: ShootFrag
CGrenade * CGrenade :: ShootFrag( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, int mode )
{
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
pGrenade->Spawn();
UTIL_SetOrigin( pGrenade->pev, vecStart );
pGrenade->pev->velocity = vecVelocity;
pGrenade->pev->angles = UTIL_VecToAngles(pGrenade->pev->velocity);
pGrenade->pev->owner = ENT(pevOwner);
pGrenade->pev->solid = SOLID_BBOX;
if ( mode == 1 )
{
SET_MODEL(ENT(pGrenade->pev), "models/w_fgrenade.mdl");
pGrenade->SetTouch( FragTouch );
pGrenade->SetThink( FragThink );
pGrenade->pev->nextthink = gpGlobals->time + 0.1;
}
else
{
SET_MODEL(ENT(pGrenade->pev), "models/w_frag.mdl");
pGrenade->SetThink( Detonate );
pGrenade->pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 2,3 );
pGrenade->pev->solid = SOLID_NOT;
}
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMFOLLOW );
WRITE_SHORT(pGrenade->entindex()); // entity
WRITE_SHORT(iFgTrail ); // model
WRITE_BYTE( 10 ); // life
WRITE_BYTE( 1.5 ); // width
WRITE_BYTE( 240 ); // r, g, b
WRITE_BYTE( 215 ); // r, g, b
WRITE_BYTE( 80 ); // r, g, b
WRITE_BYTE( 200 ); // brightness
MESSAGE_END();
pGrenade->pev->sequence = 4;
pGrenade->pev->framerate = 6;
pGrenade->pev->gravity = 0.35;
pGrenade->pev->friction = 0.9;
pGrenade->pev->dmg = 100;
return pGrenade;
}
示例5: ShootTimed
CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time )
{
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
pGrenade->Spawn();
UTIL_SetOrigin( pGrenade->pev, vecStart );
pGrenade->pev->velocity = vecVelocity;
pGrenade->pev->angles = UTIL_VecToAngles(pGrenade->pev->velocity);
pGrenade->pev->owner = ENT(pevOwner);
pGrenade->SetTouch( &CGrenade::BounceTouch ); // Bounce if touched
#ifdef DEBUG
if(ns_cvar_float(&avh_bulletcam))
{
SET_VIEW(ENT(pevOwner), ENT(pGrenade->pev));
}
#endif
// Take one second off of the desired detonation time and set the think to PreDetonate. PreDetonate
// will insert a DANGER sound into the world sound list and delay detonation for one second so that
// the grenade explodes after the exact amount of time specified in the call to ShootTimed().
pGrenade->pev->dmgtime = gpGlobals->time + time;
pGrenade->SetThink( &CGrenade::TumbleThink );
pGrenade->pev->nextthink = gpGlobals->time + 0.1;
if (time < 0.1)
{
pGrenade->pev->nextthink = gpGlobals->time;
pGrenade->pev->velocity = Vector( 0, 0, 0 );
}
pGrenade->pev->sequence = 0;//RANDOM_LONG( 3, 6 );
pGrenade->pev->framerate = 1.0;
// Tumble through the air
pGrenade->pev->avelocity.x = RANDOM_LONG(-800, -300);
// Also explode on contact
//pGrenade->SetTouch( ExplodeTouch );
pGrenade->pev->gravity = 0.5;
pGrenade->pev->friction = 0.8;
SET_MODEL(ENT(pGrenade->pev), "models/w_grenade.mdl");
return pGrenade;
}
示例6: ShootTimed
CGrenade * CGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time )
{
CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
pGrenade->Spawn();
UTIL_SetOrigin( pGrenade, vecStart );
pGrenade->SetAbsVelocity( vecVelocity );
pGrenade->SetLocalAngles( UTIL_VecToAngles( pGrenade->GetAbsVelocity( )));
pGrenade->pev->owner = ENT( pevOwner );
pGrenade->SetTouch( &CGrenade::BounceTouch ); // Bounce if touched
// Take one second off of the desired detonation time and set the think to PreDetonate. PreDetonate
// will insert a DANGER sound into the world sound list and delay detonation for one second so that
// the grenade explodes after the exact amount of time specified in the call to ShootTimed().
pGrenade->pev->dmgtime = gpGlobals->time + time;
pGrenade->SetThink( &CGrenade::TumbleThink );
pGrenade->SetNextThink( 0.1 );
if( time < 0.1 )
{
pGrenade->SetNextThink( 0 );
pGrenade->SetLocalVelocity( g_vecZero );
}
pGrenade->pev->sequence = RANDOM_LONG( 3, 6 );
pGrenade->pev->framerate = 1.0;
pGrenade->pev->gravity = 0.5;
pGrenade->pev->friction = 0.8;
SET_MODEL( pGrenade->edict(), "models/w_grenade.mdl" );
pGrenade->pev->dmg = 100;
return pGrenade;
}