本文整理汇总了C++中CASW_Marine::DoAnimationEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ CASW_Marine::DoAnimationEvent方法的具体用法?C++ CASW_Marine::DoAnimationEvent怎么用?C++ CASW_Marine::DoAnimationEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CASW_Marine
的用法示例。
在下文中一共展示了CASW_Marine::DoAnimationEvent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FireRocket
void CASW_Weapon_Hornet_Barrage::FireRocket()
{
CASW_Player *pPlayer = GetCommander();
CASW_Marine *pMarine = GetMarine();
if ( !pPlayer || !pMarine || pMarine->GetHealth() <= 0 )
{
m_iRocketsToFire = 0;
return;
}
WeaponSound(SINGLE);
// tell the marine to tell its weapon to draw the muzzle flash
pMarine->DoMuzzleFlash();
pMarine->DoAnimationEvent( PLAYERANIMEVENT_FIRE_GUN_PRIMARY );
Vector vecSrc = GetRocketFiringPosition();
m_iRocketsToFire = m_iRocketsToFire.Get() - 1;
m_flNextLaunchTime = gpGlobals->curtime + m_flFireInterval.Get();
#ifndef CLIENT_DLL
float fGrenadeDamage = MarineSkills()->GetSkillBasedValueByMarine(pMarine, ASW_MARINE_SKILL_GRENADES, ASW_MARINE_SUBSKILL_GRENADE_HORNET_DMG );
CASW_Rocket::Create( fGrenadeDamage, vecSrc, GetRocketAngle(), pMarine, this );
if ( ASWGameRules() )
{
ASWGameRules()->m_fLastFireTime = gpGlobals->curtime;
}
pMarine->OnWeaponFired( this, 1 );
#endif
}
示例2: SendWeaponSwitchEvents
// function unused (done by CASW_Marine::Weapon_Switch instead?)
void CASW_Weapon::SendWeaponSwitchEvents()
{
CASW_Marine *marine = dynamic_cast<CASW_Marine*>(GetOwner());
if (!marine)
return;
// Make the player play his reload animation. (and send to clients)
marine->DoAnimationEvent( PLAYERANIMEVENT_WEAPON_SWITCH );
}
示例3: PrimaryAttack
void CASW_Weapon_Freeze_Grenades::PrimaryAttack( void )
{
if (!m_iClip1)
return;
CASW_Player *pPlayer = GetCommander();
if (!pPlayer)
return;
CASW_Marine *pMarine = GetMarine();
bool bThisActive = (pMarine && pMarine->GetActiveWeapon() == this);
// grenade weapon is lost when all grenades are gone
if ( UsesClipsForAmmo1() && !m_iClip1 )
{
return;
}
if (pMarine && gpGlobals->curtime > m_flDelayedFire) // firing from a marine
{
#ifdef CLIENT_DLL
if ( !prediction->InPrediction() || prediction->IsFirstTimePredicted() )
{
pMarine->DoAnimationEvent( PLAYERANIMEVENT_THROW_GRENADE );
}
#else
pMarine->DoAnimationEvent( PLAYERANIMEVENT_THROW_GRENADE );
pMarine->OnWeaponFired( this, 1 );
#endif
// start our delayed attack
m_bShotDelayed = true;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = m_flDelayedFire = gpGlobals->curtime + asw_grenade_throw_delay.GetFloat();
if (!bThisActive && pMarine->GetActiveASWWeapon())
{
// if we're offhand activating, make sure our primary weapon can't fire until we're done
pMarine->GetActiveASWWeapon()->m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.4f;
pMarine->GetActiveASWWeapon()->m_bIsFiring = false;
}
}
}
示例4: PrimaryAttack
void CASW_Weapon_Bait::PrimaryAttack( void )
{
// Only the player fires this way so we can cast
CASW_Player *pPlayer = GetCommander();
if ( !pPlayer )
return;
CASW_Marine *pMarine = GetMarine();
bool bThisActive = (pMarine && pMarine->GetActiveWeapon() == this);
// weapon is lost when all ammo is gone
if ( UsesClipsForAmmo1() && !m_iClip1 )
{
return;
}
if (pMarine && gpGlobals->curtime > m_flDelayedFire)
{
#ifdef CLIENT_DLL
if ( !prediction->InPrediction() || prediction->IsFirstTimePredicted() )
{
pMarine->DoAnimationEvent( PLAYERANIMEVENT_THROW_GRENADE );
}
#else
pMarine->DoAnimationEvent( PLAYERANIMEVENT_THROW_GRENADE );
pMarine->OnWeaponFired( this, 1 );
#endif
// start our delayed attack
m_bShotDelayed = true;
m_flDelayedFire = gpGlobals->curtime + asw_bait_launch_delay.GetFloat();
m_flNextPrimaryAttack = m_flNextSecondaryAttack = 0.36f;
// make sure our primary weapon can't fire while we do the throw anim
if (!bThisActive && pMarine->GetActiveASWWeapon())
{
// if we're offhand activating, make sure our primary weapon can't fire until we're done
pMarine->GetActiveASWWeapon()->m_flNextPrimaryAttack = m_flNextPrimaryAttack + asw_bait_launch_delay.GetFloat();
pMarine->GetActiveASWWeapon()->m_bIsFiring = false;
}
}
}
示例5: SendReloadEvents
void CASW_Weapon::SendReloadEvents()
{
CASW_Marine *marine = dynamic_cast<CASW_Marine*>(GetOwner());
if (!marine)
return;
#ifdef CLIENT_DLL
if (marine->IsAnimatingReload()) // don't play the anim twice
return;
#else
CASW_GameStats.Event_MarineReloading( marine, this );
#endif
// Make the player play his reload animation. (and send to clients)
marine->DoAnimationEvent( PLAYERANIMEVENT_RELOAD );
}
示例6: SecondaryAttack
void CASW_Weapon_Assault_Shotgun::SecondaryAttack()
{
// Only the player fires this way so we can cast
CASW_Player *pPlayer = GetCommander();
if (!pPlayer)
return;
CASW_Marine *pMarine = GetMarine();
if (!pMarine)
return;
//Must have ammo
bool bUsesSecondary = UsesSecondaryAmmo();
bool bUsesClips = UsesClipsForAmmo2();
int iAmmoCount = pMarine->GetAmmoCount(m_iSecondaryAmmoType);
bool bInWater = ( pMarine->GetWaterLevel() == 3 );
if ( (bUsesSecondary &&
( ( bUsesClips && m_iClip2 <= 0) ||
( !bUsesClips && iAmmoCount<=0 )
) )
|| bInWater || m_bInReload )
{
SendWeaponAnim( ACT_VM_DRYFIRE );
BaseClass::WeaponSound( EMPTY );
m_flNextSecondaryAttack = gpGlobals->curtime + 0.5f;
return;
}
BaseClass::WeaponSound( SPECIAL1 );
#ifndef CLIENT_DLL
pMarine->GetMarineSpeech()->Chatter(CHATTER_GRENADE);
Vector vecSrc = pMarine->Weapon_ShootPosition();
Vector vecThrow;
// check for turning on lag compensation
if (pPlayer && pMarine->IsInhabited())
{
CASW_Lag_Compensation::RequestLagCompensation( pPlayer, pPlayer->GetCurrentUserCommand() );
}
vecThrow = UTIL_LaunchVector(vecSrc, pPlayer->GetCrosshairTracePos(), asw_vindicator_grenade_gravity.GetFloat()) * 8.0f * asw_vindicator_grenade_velocity.GetFloat();
QAngle angAiming = pPlayer->EyeAnglesWithCursorRoll();
float fGrenadeDamage = MarineSkills()->GetSkillBasedValueByMarine(pMarine, ASW_MARINE_SKILL_GRENADES, ASW_MARINE_SUBSKILL_GRENADE_INCENDIARY_DMG);
float fGrenadeRadius = MarineSkills()->GetSkillBasedValueByMarine(pMarine, ASW_MARINE_SKILL_GRENADES, ASW_MARINE_SUBSKILL_GRENADE_RADIUS);
if (asw_debug_marine_damage.GetBool())
{
Msg("Grenade damage = %f radius = %f\n", fGrenadeDamage, fGrenadeRadius);
}
// check the grenade fits where we want to spawn it
Ray_t ray;
trace_t pm;
ray.Init( pMarine->WorldSpaceCenter(), vecSrc, -Vector(4,4,4), Vector(4,4,4) );
UTIL_TraceRay( ray, MASK_SOLID, pMarine, COLLISION_GROUP_PROJECTILE, &pm );
if (pm.fraction < 1.0f)
vecSrc = pm.endpos;
CASW_Grenade_Vindicator::Vindicator_Grenade_Create(
fGrenadeDamage,
fGrenadeRadius,
vecSrc, angAiming, vecThrow, AngularImpulse(0,0,0), pMarine, this );
pMarine->OnWeaponFired( this, 1, true );
#endif
SendWeaponAnim( GetPrimaryAttackActivity() );
pMarine->DoAnimationEvent( PLAYERANIMEVENT_FIRE_GUN_PRIMARY );
// Decrease ammo
if ( bUsesClips )
{
m_iClip2 -= 1;
}
else
{
pMarine->RemoveAmmo( 1, m_iSecondaryAmmoType );
}
#ifndef CLIENT_DLL
ASWFailAdvice()->OnMarineUsedSecondary();
CEffectData data;
data.m_vOrigin = GetAbsOrigin();
//data.m_vNormal = dir;
//data.m_flScale = (float)amount;
CPASFilter filter( data.m_vOrigin );
filter.SetIgnorePredictionCull(true);
DispatchParticleEffect( "muzzleflash_grenadelauncher_main", PATTACH_POINT_FOLLOW, this, "muzzle", false, -1, &filter );
#endif
// Can shoot again immediately
m_flNextPrimaryAttack = gpGlobals->curtime + 0.5f;
// Can blow up after a short delay (so have time to release mouse button)
m_flNextSecondaryAttack = gpGlobals->curtime + 1.0f;
}
示例7: Fire
void CASW_Weapon_Chainsaw::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
{
CASW_Marine *pMarine = GetMarine();
if ( !pMarine )
{
return;
}
StopAttackOffSound();
StartChainsawSound();
if ( m_flFireAnimTime < gpGlobals->curtime )
{
pMarine->DoAnimationEvent( PLAYERANIMEVENT_FIRE_GUN_PRIMARY );
m_flFireAnimTime = gpGlobals->curtime + 0.1f;
}
Vector vecDest = vecOrigSrc + (vecDir * ASW_CHAINSAW_RANGE);
bool bDamageTime = m_flDmgTime < gpGlobals->curtime;
bool bHit = false;
Ray_t ray;
ray.Init( vecOrigSrc, vecDest, Vector( -5, -5, -5 ), Vector( 5, 5, 25 ) );
CBaseEntity *(pEntities[ 8 ]);
CHurtableEntitiesEnum hurtableEntities( pEntities, 8 );
partition->EnumerateElementsAlongRay( PARTITION_ENGINE_NON_STATIC_EDICTS | PARTITION_ENGINE_SOLID_EDICTS, ray, false, &hurtableEntities );
trace_t tr;
for ( int i = 0; i < hurtableEntities.GetCount(); ++i )
{
CBaseEntity *pEntity = pEntities[ i ];
if ( pEntity == NULL || pEntity == pMarine )
continue;
bHit = true;
if ( bDamageTime )
{
// wide mode does damage to the ent, and radius damage
if ( pEntity->m_takedamage != DAMAGE_NO )
{
CTraceFilterOnlyHitThis filter( pEntity );
UTIL_TraceHull( vecOrigSrc, vecDest, Vector( -5, -5, -2 ), Vector( 5, 5, 25 ), MASK_SHOT, &filter, &tr );
ClearMultiDamage();
float fDamage = 0.5f * GetWeaponInfo()->m_flBaseDamage + MarineSkills()->GetSkillBasedValueByMarine( pMarine, ASW_MARINE_SKILL_MELEE, ASW_MARINE_SUBSKILL_MELEE_DMG );
CTakeDamageInfo info( this, pMarine, fDamage * g_pGameRules->GetDamageMultiplier(), DMG_SLASH );
info.SetWeapon( this );
CalculateMeleeDamageForce( &info, vecDir, tr.endpos );
pEntity->DispatchTraceAttack( info, vecDir, &tr );
ApplyMultiDamage();
}
// radius damage a little more potent in multiplayer.
#ifndef CLIENT_DLL
//RadiusDamage( CTakeDamageInfo( this, pMarine, sk_plr_dmg_asw_ml.GetFloat() * g_pGameRules->GetDamageMultiplier() / 4, DMG_ENERGYBEAM | DMG_BLAST | DMG_ALWAYSGIB ), tr.endpos, 128, CLASS_NONE, NULL );
#endif
}
}
if ( bHit )
{
if ( bDamageTime )
{
m_bIsFiring = true;
m_flLastHitTime = gpGlobals->curtime;
m_flTargetChainsawPitch = 0.0f;
#ifndef CLIENT_DLL
pMarine->OnWeaponFired( this, 1 );
#endif
if ( !pMarine->IsAlive() )
return;
// uses 5 ammo/second
if ( gpGlobals->curtime >= m_flAmmoUseTime )
{
// chainsaw no longer uses ammo
m_flAmmoUseTime = gpGlobals->curtime + 0.2;
/*
// decrement ammo
//m_iClip1 -= 1;
#ifdef GAME_DLL
CASW_Marine *pMarine = GetMarine();
if (pMarine && m_iClip1 <= 0 && pMarine->GetAmmoCount(m_iPrimaryAmmoType) <= 0 )
{
// check he doesn't have ammo in an ammo bay
CASW_Weapon_Ammo_Bag* pAmmoBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetASWWeapon(0));
if (!pAmmoBag)
pAmmoBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetASWWeapon(1));
//.........这里部分代码省略.........