本文整理汇总了C++中CBaseCombatCharacter::ApplyAbsVelocityImpulse方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseCombatCharacter::ApplyAbsVelocityImpulse方法的具体用法?C++ CBaseCombatCharacter::ApplyAbsVelocityImpulse怎么用?C++ CBaseCombatCharacter::ApplyAbsVelocityImpulse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseCombatCharacter
的用法示例。
在下文中一共展示了CBaseCombatCharacter::ApplyAbsVelocityImpulse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleAnimEvent
//.........这里部分代码省略.........
pGrenade->SetSpitSize(SPIT_LARGE);
pGrenade->SetAbsVelocity(vecToss * flVelocity);
}
else
{
pGrenade->SetAbsVelocity((vecToss + RandomVector(-0.035f, 0.035f)) * flVelocity);
pGrenade->SetSpitSize(random->RandomInt(SPIT_SMALL, SPIT_MEDIUM));
}
// Tumble through the air
pGrenade->SetLocalAngularVelocity(QAngle(random->RandomFloat(-250, -500),
random->RandomFloat(-250, -500),
random->RandomFloat(-250, -500)));
}
for (int i = 0; i < 8; i++)
{
DispatchParticleEffect("blood_impact_yellow_01", vSpitPos + RandomVector(-12.0f, 12.0f), RandomAngle(0, 360));
}
EmitSound("NPC_Antlion.PoisonShoot");
}
break;
case BSQUID_AE_BITE:
{
// SOUND HERE!
CBaseEntity *pHurt = CheckTraceHullAttack( 70, Vector(-16,-16,-16), Vector(16,16,16), sk_bullsquid_dmg_bite.GetFloat(), DMG_SLASH );
if ( pHurt )
{
Vector forward, up;
AngleVectors( GetAbsAngles(), &forward, NULL, &up );
pHurt->ApplyAbsVelocityImpulse( 100 * (up-forward) );
pHurt->SetGroundEntity( NULL );
}
}
break;
case BSQUID_AE_WHIP_SND:
{
EmitSound( "NPC_Bullsquid.TailWhip" );
break;
}
/*
case BSQUID_AE_TAILWHIP:
{
CBaseEntity *pHurt = CheckTraceHullAttack( 70, Vector(-16,-16,-16), Vector(16,16,16), sk_bullsquid_dmg_whip.GetFloat(), DMG_SLASH | DMG_ALWAYSGIB );
if ( pHurt )
{
Vector right, up;
AngleVectors( GetAbsAngles(), NULL, &right, &up );
if ( pHurt->GetFlags() & ( FL_NPC | FL_CLIENT ) )
pHurt->ViewPunch( QAngle( 20, 0, -20 ) );
pHurt->ApplyAbsVelocityImpulse( 100 * (up+2*right) );
}
}
break;
*/
case BSQUID_AE_BLINK:
{
// close eye.
示例2: HandleAnimEvent
//.........这里部分代码省略.........
Vector forward, up;
AngleVectors( GetAbsAngles(), &forward, NULL, &up );
pHurt->SetAbsVelocity( pHurt->GetAbsVelocity() - (forward * 100) );
pHurt->SetAbsVelocity( pHurt->GetAbsVelocity() + (up * 100) );
pHurt->RemoveFlag( FL_ONGROUND );
}
}
break;
case BSQUID_AE_WHIP_SND:
{
EmitSound( "NPC_Bullsquid.TailWhip" );
break;
}
/*
case BSQUID_AE_TAILWHIP:
{
CBaseEntity *pHurt = CheckTraceHullAttack( 70, Vector(-16,-16,-16), Vector(16,16,16), sk_bullsquid_dmg_whip.GetFloat(), DMG_SLASH | DMG_ALWAYSGIB );
if ( pHurt )
{
Vector right, up;
AngleVectors( GetAbsAngles(), NULL, &right, &up );
if ( pHurt->GetFlags() & ( FL_NPC | FL_CLIENT ) )
pHurt->ViewPunch( QAngle( 20, 0, -20 ) );
pHurt->SetAbsVelocity( pHurt->GetAbsVelocity() + (right * 200) );
pHurt->SetAbsVelocity( pHurt->GetAbsVelocity() + (up * 100) );
}
}
break;
*/
case BSQUID_AE_BLINK:
{
// close eye.
m_nSkin = 1;
}
break;
case BSQUID_AE_HOP:
{
float flGravity = sv_gravity.GetFloat();
// throw the squid up into the air on this frame.
if ( GetFlags() & FL_ONGROUND )
{
RemoveFlag( FL_ONGROUND );
}
// jump into air for 0.8 (24/30) seconds
Vector vecVel = GetAbsVelocity();
vecVel.z += ( 0.625 * flGravity ) * 0.5;
SetAbsVelocity( vecVel );
}
break;
case BSQUID_AE_THROW:
{
// squid throws its prey IF the prey is a client.
CBaseEntity *pHurt = CheckTraceHullAttack( 70, Vector(-16,-16,-16), Vector(16,16,16), 0, 0 );
if ( pHurt )
{
pHurt->ViewPunch( QAngle(20,0,-20) );
// screeshake transforms the viewmodel as well as the viewangle. No problems with seeing the ends of the viewmodels.
UTIL_ScreenShake( pHurt->GetAbsOrigin(), 25.0, 1.5, 0.7, 2, SHAKE_START );
// If the player, throw him around
if ( pHurt->IsPlayer())
{
Vector forward, up;
AngleVectors( GetLocalAngles(), &forward, NULL, &up );
pHurt->ApplyAbsVelocityImpulse( forward * 300 + up * 300 );
}
// If not the player see if has bullsquid throw interatcion
else
{
CBaseCombatCharacter *pVictim = ToBaseCombatCharacter( pHurt );
if (pVictim)
{
if ( pVictim->HandleInteraction( g_interactionBullsquidThrow, NULL, this ) )
{
Vector forward, up;
AngleVectors( GetLocalAngles(), &forward, NULL, &up );
pVictim->ApplyAbsVelocityImpulse( forward * 300 + up * 250 );
}
}
}
}
}
break;
default:
BaseClass::HandleAnimEvent( pEvent );
}
}