本文整理汇总了C++中CBaseAnimating::Ignite方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseAnimating::Ignite方法的具体用法?C++ CBaseAnimating::Ignite怎么用?C++ CBaseAnimating::Ignite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseAnimating
的用法示例。
在下文中一共展示了CBaseAnimating::Ignite方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CBaseEntity *CreateRagGib( const char *szModel, const Vector &vecOrigin, const QAngle &vecAngles, const Vector &vecForce, float flFadeTime, bool bShouldIgnite )
{
CRagGib *pGib;
pGib = (CRagGib*)CreateEntityByName( "raggib" );
pGib->SetLocalAngles( vecAngles );
if ( !pGib )
{
Msg( "**Can't create ragdoll gib!\n" );
return NULL;
}
if ( bShouldIgnite )
{
CBaseAnimating *pAnimating = pGib->GetBaseAnimating();
if (pAnimating != NULL )
{
pAnimating->Ignite( random->RandomFloat( 8.0, 12.0 ), false );
}
}
pGib->Spawn( szModel, vecOrigin, vecForce, flFadeTime );
return pGib;
}
示例2: FlareTouch
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pOther -
//-----------------------------------------------------------------------------
void CFlare::FlareTouch( CBaseEntity *pOther )
{
Assert( pOther );
if ( !pOther->IsSolid() )
return;
if ( ( m_nBounces < 10 ) && ( GetWaterLevel() < 1 ) )
{
// Throw some real chunks here
g_pEffects->Sparks( GetAbsOrigin() );
}
//If the flare hit a person or NPC, do damage here.
if ( pOther && pOther->m_takedamage )
{
/*
The Flare is the iRifle round right now. No damage, just ignite. (sjb)
//Damage is a function of how fast the flare is flying.
int iDamage = GetAbsVelocity().Length() / 50.0f;
if ( iDamage < 5 )
{
//Clamp minimum damage
iDamage = 5;
}
//Use m_pOwner, not GetOwnerEntity()
pOther->TakeDamage( CTakeDamageInfo( this, m_pOwner, iDamage, (DMG_BULLET|DMG_BURN) ) );
m_flNextDamage = gpGlobals->curtime + 1.0f;
*/
CBaseAnimating *pAnim;
pAnim = dynamic_cast<CBaseAnimating*>(pOther);
if( pAnim )
{
pAnim->Ignite( 30.0f );
}
Vector vecNewVelocity = GetAbsVelocity();
vecNewVelocity *= 0.1f;
SetAbsVelocity( vecNewVelocity );
SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
SetGravity(1.0f);
Die( 0.5 );
return;
}
else
{
// hit the world, check the material type here, see if the flare should stick.
trace_t tr;
tr = CBaseEntity::GetTouchTrace();
//Only do this on the first bounce
if ( m_nBounces == 0 )
{
const surfacedata_t *pdata = physprops->GetSurfaceData( tr.surface.surfaceProps );
if ( pdata != NULL )
{
//Only embed into concrete and wood (jdw: too obscure for players?)
//if ( ( pdata->gameMaterial == 'C' ) || ( pdata->gameMaterial == 'W' ) )
{
Vector impactDir = ( tr.endpos - tr.startpos );
VectorNormalize( impactDir );
float surfDot = tr.plane.normal.Dot( impactDir );
//Do not stick to ceilings or on shallow impacts
if ( ( tr.plane.normal.z > -0.5f ) && ( surfDot < -0.9f ) )
{
RemoveSolidFlags( FSOLID_NOT_SOLID );
AddSolidFlags( FSOLID_TRIGGER );
UTIL_SetOrigin( this, tr.endpos + ( tr.plane.normal * 2.0f ) );
SetAbsVelocity( vec3_origin );
SetMoveType( MOVETYPE_NONE );
SetTouch( &CFlare::FlareBurnTouch );
int index = decalsystem->GetDecalIndexForName( "SmallScorch" );
if ( index >= 0 )
{
CBroadcastRecipientFilter filter;
te->Decal( filter, 0.0, &tr.endpos, &tr.startpos, ENTINDEX( tr.m_pEnt ), tr.hitbox, index );
}
CPASAttenuationFilter filter2( this, "Flare.Touch" );
EmitSound( filter2, entindex(), "Flare.Touch" );
return;
}
//.........这里部分代码省略.........
示例3: OnTouch
//Called from PhysicsSimulate() or ReceiveMessage()
bool CDHLProjectile::OnTouch( trace_t &touchtr, bool bDecalOnly /*= false*/, ITraceFilter* pTraceFilter /*= NULL*/ )
{
//Direction
Vector vecDir = touchtr.endpos - touchtr.startpos;
if ( vecDir == vec3_origin ) //Sometimes endpos==startpos so we need to get dir from velocity instead
{
#ifdef CLIENT_DLL
vecDir = GetLocalVelocity();
#else
vecDir = m_vecCurVelocity;
#endif
VectorNormalize( vecDir );
}
CBaseEntity* ent = touchtr.m_pEnt;
if ( !ent )
return false;
if ( touchtr.DidHit() )
{
//Never collide with self, shooter, or other projectiles
if ( ent == this || dynamic_cast<CDHLProjectile*>(ent)
|| ent == (CBaseEntity*)m_pShooter )
//|| ( (m_iType == DHL_PROJECTILE_TYPE_COMBATKNIFE) && (ent == m_pFiringWeapon) ) ) //Combat knife - don't collide with weapon ent
return false;
//Hack: Sometimes hits are registered prematurely (usually to the torso area) with no hitbox. Pretend nothing happened unless one is found.
if ( ent->IsPlayer() && touchtr.hitgroup == 0 )
return false;
//Check friendly fire
if ( CheckFriendlyFire( ent ) )
{
if ( !bDecalOnly )
{
ClearMultiDamage();
//Do damage
CTakeDamageInfo dmgInfo( this, GetOwnerEntity(), m_iDamage, DMG_BULLET );
if ( m_iType == DHL_PROJECTILE_TYPE_COMBATKNIFE )
{
//CalculateMeleeDamageForce( &dmgInfo, vecDir, touchtr.endpos, 0.01f );
Vector vecForce = vecDir;
VectorNormalize( vecForce );
//vecForce *= 10.0f; //Ripped from C_ClientRagdoll::ImpactTrace
dmgInfo.SetDamageForce( vecForce );
#ifndef CLIENT_DLL
if ( IsOnFire() )
{
CBaseAnimating* pBAnim = dynamic_cast<CBaseAnimating*>(ent);
if ( pBAnim )
pBAnim->Ignite( 10.0f, false );
}
#endif
}
else
CalculateBulletDamageForce( &dmgInfo, m_iAmmoType, vecDir, touchtr.endpos, 1.0f );
dmgInfo.SetDamagePosition( touchtr.endpos );
ent->DispatchTraceAttack( dmgInfo, vecDir, &touchtr );
ApplyMultiDamage();
}
#ifdef CLIENT_DLL
if ( ent->GetCollisionGroup() == COLLISION_GROUP_BREAKABLE_GLASS )
return false;
//Decals and such
if ( !( touchtr.surface.flags & SURF_SKY ) && !touchtr.allsolid )
{
IPredictionSystem::SuppressEvents( false );
if ( (m_iType == DHL_PROJECTILE_TYPE_BULLET || m_iType == DHL_PROJECTILE_TYPE_PELLET) )
{
UTIL_ImpactTrace( &touchtr, DMG_BULLET );
}
if ( m_iType == DHL_PROJECTILE_TYPE_COMBATKNIFE )
PlayImpactSound( touchtr.m_pEnt, touchtr, touchtr.endpos, touchtr.surface.surfaceProps );
IPredictionSystem::SuppressEvents( !prediction->IsFirstTimePredicted() );
}
#endif
}
if ( pTraceFilter && m_iType != DHL_PROJECTILE_TYPE_COMBATKNIFE )
{
PenetrationData_t nPenetrationData = DHLShared::TestPenetration( touchtr, m_pShooter, pTraceFilter,
m_iTimesPenetrated, m_flDistanceTravelled, m_iAmmoType );
if ( nPenetrationData.m_bShouldPenetrate )
{
m_flDistanceTravelled += GetLocalOrigin().DistTo( nPenetrationData.m_vecNewBulletPos );
MoveProjectileToPosition( nPenetrationData.m_vecNewBulletPos );
m_iTimesPenetrated++;
return true; //Keep going - but don't do anything else in this frame of PhysicsSimulate()
}
}
//We're done unless what we hit was breakable glass
if ( ent->GetCollisionGroup() != COLLISION_GROUP_BREAKABLE_GLASS )
{
#ifdef CLIENT_DLL
//.........这里部分代码省略.........