本文整理汇总了C++中CBaseGrenade::SetDamageRadius方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseGrenade::SetDamageRadius方法的具体用法?C++ CBaseGrenade::SetDamageRadius怎么用?C++ CBaseGrenade::SetDamageRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseGrenade
的用法示例。
在下文中一共展示了CBaseGrenade::SetDamageRadius方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LobGrenade
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPlayer -
//-----------------------------------------------------------------------------
void CWeaponFrag::LobGrenade( CBasePlayer *pPlayer )
{
#ifndef CLIENT_DLL
Vector vecEye = pPlayer->EyePosition();
Vector vForward, vRight;
pPlayer->EyeVectors( &vForward, &vRight, NULL );
Vector vecSrc = vecEye + vForward * 18.0f + vRight * 8.0f + Vector( 0, 0, -8 );
CheckThrowPosition( pPlayer, vecEye, vecSrc );
Vector vecThrow;
pPlayer->GetVelocity( &vecThrow, NULL );
vecThrow += vForward * 350 + Vector( 0, 0, 50 );
CBaseGrenade *pGrenade = Fraggrenade_Create( vecSrc, vec3_angle, vecThrow, AngularImpulse(200,random->RandomInt(-600,600),0), pPlayer, GRENADE_TIMER, false );
if ( pGrenade )
{
pGrenade->SetDamage( GetHL2MPWpnData().m_iPlayerDamage );
pGrenade->SetDamageRadius( GRENADE_DAMAGE_RADIUS );
}
#endif
WeaponSound( WPN_DOUBLE );
// player "shoot" animation
pPlayer->SetAnimation( PLAYER_ATTACK1 );
m_bRedraw = true;
}
示例2: ThrowGrenade
void CWeaponGrenade::ThrowGrenade( CBasePlayer *pPlayer )
{
#ifndef CLIENT_DLL
Vector vecEye = pPlayer->EyePosition();
Vector vForward, vRight;
pPlayer->EyeVectors( &vForward, &vRight, NULL );
Vector vecSrc = vecEye + vForward * 18.0f + vRight * 8.0f;
CheckThrowPosition( pPlayer, vecEye, vecSrc );
vForward[2] += 0.1f;
Vector vecThrow;
pPlayer->GetVelocity( &vecThrow, NULL );
vecThrow += vForward * 1200;
CBaseGrenade *pGrenade = GrenadeBoing_Create( vecSrc, vec3_angle, vecThrow, AngularImpulse(600,random->RandomInt(-1200,1200),0), pPlayer, GRENADE_TIMER, false );
if ( pGrenade )
{
if ( pPlayer && pPlayer->m_lifeState != LIFE_ALIVE )
{
pPlayer->GetVelocity( &vecThrow, NULL );
IPhysicsObject *pPhysicsObject = pGrenade->VPhysicsGetObject();
if ( pPhysicsObject )
pPhysicsObject->SetVelocity( &vecThrow, NULL );
}
pGrenade->SetDamage( GetHL2MPWpnData().m_iPlayerDamage );
pGrenade->SetDamageRadius( GRENADE_DAMAGE_RADIUS );
}
#endif
}
示例3: RollGrenade
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPlayer -
//-----------------------------------------------------------------------------
void CWeaponFrag::RollGrenade( CBasePlayer *pPlayer )
{
#ifndef CLIENT_DLL
// BUGBUG: Hardcoded grenade width of 4 - better not change the model :)
Vector vecSrc;
pPlayer->CollisionProp()->NormalizedToWorldSpace( Vector( 0.5f, 0.5f, 0.0f ), &vecSrc );
vecSrc.z += GRENADE_RADIUS;
Vector vecFacing = pPlayer->BodyDirection2D( );
// no up/down direction
vecFacing.z = 0;
VectorNormalize( vecFacing );
trace_t tr;
UTIL_TraceLine( vecSrc, vecSrc - Vector(0,0,16), MASK_PLAYERSOLID, pPlayer, COLLISION_GROUP_NONE, &tr );
if ( tr.fraction != 1.0 )
{
// compute forward vec parallel to floor plane and roll grenade along that
Vector tangent;
CrossProduct( vecFacing, tr.plane.normal, tangent );
CrossProduct( tr.plane.normal, tangent, vecFacing );
}
vecSrc += (vecFacing * 18.0);
CheckThrowPosition( pPlayer, pPlayer->WorldSpaceCenter(), vecSrc );
Vector vecThrow;
pPlayer->GetVelocity( &vecThrow, NULL );
vecThrow += vecFacing * 700;
// put it on its side
QAngle orientation(0,pPlayer->GetLocalAngles().y,-90);
// roll it
AngularImpulse rotSpeed(0,0,720);
CBaseGrenade *pGrenade = Fraggrenade_Create( vecSrc, orientation, vecThrow, rotSpeed, pPlayer, GRENADE_TIMER, false );
if ( pGrenade )
{
pGrenade->SetDamage( GetHL2MPWpnData().m_iPlayerDamage );
pGrenade->SetDamageRadius( GRENADE_DAMAGE_RADIUS );
}
#endif
WeaponSound( SPECIAL1 );
// player "shoot" animation
pPlayer->SetAnimation( PLAYER_ATTACK1 );
m_bRedraw = true;
}
示例4: ThrowGrenade
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPlayer -
//-----------------------------------------------------------------------------
void CWeaponFrag::ThrowGrenade( CBasePlayer *pPlayer )
{
#ifndef CLIENT_DLL
Vector vecEye = pPlayer->EyePosition();
Vector vForward, vRight;
pPlayer->EyeVectors( &vForward, &vRight, NULL );
Vector vecSrc = vecEye + vForward * 18.0f + vRight * 8.0f;
CheckThrowPosition( pPlayer, vecEye, vecSrc );
// vForward[0] += 0.1f;
vForward[2] += 0.1f;
Vector vecThrow;
pPlayer->GetVelocity( &vecThrow, NULL );
vecThrow += vForward * 1200;
CBaseGrenade *pGrenade = Fraggrenade_Create( vecSrc, vec3_angle, vecThrow, AngularImpulse(600,random->RandomInt(-1200,1200),0), pPlayer, GRENADE_TIMER, false );
if ( pGrenade )
{
if ( pPlayer && pPlayer->m_lifeState != LIFE_ALIVE )
{
pPlayer->GetVelocity( &vecThrow, NULL );
IPhysicsObject *pPhysicsObject = pGrenade->VPhysicsGetObject();
if ( pPhysicsObject )
{
pPhysicsObject->SetVelocity( &vecThrow, NULL );
}
}
pGrenade->SetDamage( GetHL2MPWpnData().m_iPlayerDamage );
pGrenade->SetDamageRadius( GRENADE_DAMAGE_RADIUS );
}
#endif
m_bRedraw = true;
WeaponSound( SINGLE );
// player "shoot" animation
pPlayer->SetAnimation( PLAYER_ATTACK1 );
}
示例5: ThrowGrenade
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPlayer -
//-----------------------------------------------------------------------------
void CWeaponFrag::ThrowGrenade( CBasePlayer *pPlayer, bool Invis /*= false*/ )
{
#ifndef CLIENT_DLL
Vector vecEye = pPlayer->EyePosition();
Vector vForward, vRight;
pPlayer->EyeVectors( &vForward, &vRight, NULL );
Vector vecSrc = vecEye + vForward * 18.0f + vRight * 8.0f;
CheckThrowPosition( pPlayer, vecEye, vecSrc );
// vForward[0] += 0.1f;
vForward[2] += 0.1f;
Vector vecThrow;
pPlayer->GetVelocity( &vecThrow, NULL );
//DHL - We're just gonna set the grenade off at vecSrc if it goes off "in their hand", so don't worry about velocity
if ( !Invis )
vecThrow += vForward * 1200;
//DHL: Added conditional to last arg, to allow priming...
//If we haven't hit the time we should explode yet, use the remaining time as the clock for the grenade
//Otherwise (we're due to explode) throw (will be forced in the PostFrame function) and go off near immediately
CBaseGrenade *pGrenade = Fraggrenade_Create( vecSrc, vec3_angle, vecThrow, AngularImpulse(600,random->RandomInt(-1200,1200),0), pPlayer, ( (flExplodeTime > gpGlobals->curtime) ? (flExplodeTime - gpGlobals->curtime) : 0.01f ), false );
if ( pGrenade )
{
if ( pPlayer && pPlayer->m_lifeState != LIFE_ALIVE )
{
pPlayer->GetVelocity( &vecThrow, NULL );
IPhysicsObject *pPhysicsObject = pGrenade->VPhysicsGetObject();
if ( pPhysicsObject )
{
pPhysicsObject->SetVelocity( &vecThrow, NULL );
}
}
pGrenade->SetDamage( GetHL2MPWpnData().m_iPlayerDamage );
pGrenade->SetDamageRadius( GRENADE_DAMAGE_RADIUS );
if ( Invis ) //DHL - Don't always want to be able to see the grenade
{
pGrenade->AddEffects( EF_NODRAW );
pGrenade->SetMoveType( MOVETYPE_NONE );
CUtlVector<CBaseEntity *> childrenList;
GetAllChildren( pGrenade, childrenList );
if ( childrenList.Count() ) // If there's any children in the list...
{
for ( int i = childrenList.Count()-1; i >= 0; --i )
{
UTIL_Remove( childrenList[i] ); //Remove them all
}
}
pGrenade->SetAbsVelocity( vec3_origin );
pGrenade->SetAbsOrigin( vecSrc ); //Put the grenade right back in their hand incase it's moved
pGrenade->Detonate();
}
}
#endif
m_bRedraw = true;
WeaponSound( SINGLE );
// player "shoot" animation
pPlayer->SetAnimation( PLAYER_ATTACK1 );
}