本文整理汇总了C++中EmitSound函数的典型用法代码示例。如果您正苦于以下问题:C++ EmitSound函数的具体用法?C++ EmitSound怎么用?C++ EmitSound使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EmitSound函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filter
//=========================================================
// AttackSound
//=========================================================
void CNPC_Bullsquid::AttackSound( void )
{
CPASAttenuationFilter filter( this );
EmitSound( filter, entindex(), "Bullsquid.Attack" );
}
示例2: EmitSound
//-----------------------------------------------------------------------------
// Purpose: Play a random attack miss sound
//-----------------------------------------------------------------------------
void CNPC_Zombine::AttackMissSound( void )
{
// Play a random attack miss sound
EmitSound( "Zombie.AttackMiss" );
}
示例3: EmitSound
void C_WeaponCombat_ChargeablePlasma::StartCharging()
{
CLocalPlayerFilter filter;
EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, "WeaponCombat_ChargeablePlasma.Charging" );
m_flChargeStartTime = gpGlobals->curtime;
}
示例4: Detonate
//-----------------------------------------------------------------------------
// Purpose: Intercept damage and decide whether or not we want to trigger
// Input : &info -
//-----------------------------------------------------------------------------
int CWeaponStriderBuster::OnTakeDamage( const CTakeDamageInfo &info )
{
// If we're attached, any damage from the player makes us trigger
CBaseEntity *pInflictor = info.GetInflictor();
CBaseEntity *pAttacker = info.GetAttacker();
bool bInflictorIsPlayer = ( pInflictor != NULL && pInflictor->IsPlayer() );
bool bAttackerIsPlayer = ( pAttacker != NULL && pAttacker->IsPlayer() );
if ( GetParent() && GetParent()->ClassMatches( g_iszVehicle ) )
{
return 0;
}
// Only take damage from a player, for the moment
if ( striderbuster_allow_all_damage.GetBool() || ( IsAttachedToStrider() && ( bAttackerIsPlayer || bInflictorIsPlayer ) ) )
{
Detonate();
return 0;
}
if ( pAttacker && ( pAttacker->Classify() == CLASS_COMBINE || pAttacker->Classify() == CLASS_COMBINE_HUNTER ) )
{
if ( VPhysicsGetObject() && !VPhysicsGetObject()->IsMoveable() )
{
return 0;
}
}
// Hunters are able to destroy strider busters
if ( hunter_hate_held_striderbusters.GetBool() || hunter_hate_thrown_striderbusters.GetBool() || hunter_hate_attached_striderbusters.GetBool() )
{
if ( ( GetHealth() > 0 ) && ( pInflictor != NULL ) && FClassnameIs( pInflictor, "hunter_flechette" ) )
{
//
// Flechette impacts don't hurt the striderbuster unless it's attached to a strider,
// but the explosions always do. This is so that held or thrown striderbusters fly
// awry because of the flechette, but attached striderbusters break instantly to make
// the hunters more effective at defending the strider.
//
if ( IsAttachedToStrider() || !( info.GetDamageType() & DMG_NEVERGIB ) )
{
if( striderbuster_die_detach.GetBool() && IsAttachedToStrider() )
{
// Make the buster fall off and break.
m_takedamage = DAMAGE_NO;
CNPC_Strider *pStrider = dynamic_cast<CNPC_Strider *>(GetOwnerEntity());
Assert( pStrider != NULL );
pStrider->StriderBusterDetached( this );
DestroyConstraint();
// Amplify some lateral force.
Vector vecForce = info.GetDamageForce();
vecForce.z = 0.0f;
VPhysicsGetObject()->ApplyForceCenter( vecForce * 5.0f );
SetContextThink( NULL, gpGlobals->curtime, s_pBusterPingThinkContext );
SetThink( &CWeaponStriderBuster::BusterDetachThink );
SetNextThink( gpGlobals->curtime );
m_iBusterFlags |= STRIDERBUSTER_FLAG_KNOCKED_OFF_STRIDER;
return 0;
}
else
{
// Destroy the buster in place
// Make sure they know it blew up prematurely.
EmitSound( "Weapon_StriderBuster.Dud_Detonate" );
DispatchParticleEffect( "striderbuster_break_flechette", GetAbsOrigin(), GetAbsAngles() );
SetHealth( 0 );
Shatter( info.GetAttacker() );
return 0;
}
}
if ( info.GetDamage() < 5 )
{
bool bFirst = ( m_CarryAngles.x == 45 && m_CarryAngles.y == 0 && m_CarryAngles.z == 0);
float sinTime = sin( gpGlobals->curtime );
bool bSubtractX = ( bFirst ) ? ( sinTime < 0 ) : ( m_CarryAngles.x < 45 );
m_CarryAngles.x += ( 10.0 + 10.0 * fabsf( sinTime ) + random->RandomFloat( -2.5, 2.5 ) + random->RandomFloat( -2.5, 2.5 ) ) * ( ( bSubtractX ) ? -1.0 : 1.0 );
m_CarryAngles.y = 15 * ( sin( gpGlobals->curtime ) + cos( gpGlobals->curtime * 0.5 ) ) * .5 + random->RandomFloat( -15, 15 );
m_CarryAngles.z = 7.5 * ( sin( gpGlobals->curtime ) + sin( gpGlobals->curtime * 2.0 ) ) * .5 + random->RandomFloat( -7.5, 7.5 );
}
return 1;
}
}
// Allow crushing damage
if ( info.GetDamageType() & DMG_CRUSH )
return BaseClass::OnTakeDamage( info );
//.........这里部分代码省略.........
示例5: GetAttachment
void CNPC_Zombine::HandleAnimEvent( animevent_t *pEvent )
{
if ( pEvent->event == AE_ZOMBINE_PULLPIN )
{
Vector vecStart;
QAngle angles;
GetAttachment( "grenade_attachment", vecStart, angles );
CBaseGrenade *pGrenade = Fraggrenade_Create( vecStart, vec3_angle, vec3_origin, AngularImpulse( 0, 0, 0 ), this, 3.5f, true );
if ( pGrenade )
{
// Move physobject to shadow
IPhysicsObject *pPhysicsObject = pGrenade->VPhysicsGetObject();
if ( pPhysicsObject )
{
pGrenade->VPhysicsDestroyObject();
int iAttachment = LookupAttachment( "grenade_attachment");
pGrenade->SetMoveType( MOVETYPE_NONE );
pGrenade->SetSolid( SOLID_NONE );
pGrenade->SetCollisionGroup( COLLISION_GROUP_DEBRIS );
pGrenade->SetAbsOrigin( vecStart );
pGrenade->SetAbsAngles( angles );
pGrenade->SetParent( this, iAttachment );
pGrenade->SetDamage( 200.0f );
m_hGrenade = pGrenade;
EmitSound( "Zombine.ReadyGrenade" );
// Tell player allies nearby to regard me!
CAI_BaseNPC **ppAIs = g_AI_Manager.AccessAIs();
CAI_BaseNPC *pNPC;
for ( int i = 0; i < g_AI_Manager.NumAIs(); i++ )
{
pNPC = ppAIs[i];
if( pNPC->Classify() == CLASS_PLAYER_ALLY || ( pNPC->Classify() == CLASS_PLAYER_ALLY_VITAL && pNPC->FVisible(this) ) )
{
int priority;
Disposition_t disposition;
priority = pNPC->IRelationPriority(this);
disposition = pNPC->IRelationType(this);
pNPC->AddEntityRelationship( this, disposition, priority + 1 );
}
}
}
m_iGrenadeCount--;
}
return;
}
if ( pEvent->event == AE_NPC_ATTACK_BROADCAST )
{
if ( HasGrenade() )
return;
}
BaseClass::HandleAnimEvent( pEvent );
}
示例6: switch
//.........这里部分代码省略.........
if( gpGlobals->curtime > m_flWaitFinished )
{
TaskComplete();
}
break;
case TASK_ROLLER_WAIT_FOR_PHYSICS:
{
Vector vecVelocity;
VPhysicsGetObject()->GetVelocity( &vecVelocity, NULL );
if( VPhysicsGetObject()->IsAsleep() )
{
TaskComplete();
}
}
break;
case TASK_RUN_PATH:
case TASK_WALK_PATH:
// Start turning early
if( (GetLocalOrigin() - GetNavigator()->GetCurWaypointPos() ).Length() <= 64 )
{
if( GetNavigator()->CurWaypointIsGoal() )
{
// Hit the brakes a bit.
float yaw = UTIL_VecToYaw( GetNavigator()->GetCurWaypointPos() - GetLocalOrigin() );
Vector vecRight;
AngleVectors( QAngle( 0, yaw, 0 ), NULL, &vecRight, NULL );
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, -m_flForwardSpeed * 5 );
TaskComplete();
return;
}
GetNavigator()->AdvancePath();
}
{
float yaw = UTIL_VecToYaw( GetNavigator()->GetCurWaypointPos() - GetLocalOrigin() );
Vector vecRight;
Vector vecToPath; // points at the path
AngleVectors( QAngle( 0, yaw, 0 ), &vecToPath, &vecRight, NULL );
// figure out if the roller is turning. If so, cut the throttle a little.
float flDot;
Vector vecVelocity;
VPhysicsGetObject()->GetVelocity( &vecVelocity, NULL );
VectorNormalize( vecVelocity );
vecVelocity.z = 0;
flDot = DotProduct( vecVelocity, vecToPath );
m_RollerController.m_vecAngular = vec3_origin;
if( flDot > 0.25 && flDot < 0.7 )
{
// Feed a little torque backwards into the axis perpendicular to the velocity.
// This will help get rid of momentum that would otherwise make us overshoot our goal.
Vector vecCompensate;
vecCompensate.x = vecVelocity.y;
vecCompensate.y = -vecVelocity.x;
vecCompensate.z = 0;
m_RollerController.m_vecAngular = WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecCompensate, m_flForwardSpeed * -0.75 );
}
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, m_flForwardSpeed );
}
break;
case TASK_ROLLER_ISSUE_CODE:
if( gpGlobals->curtime >= m_flWaitFinished )
{
if( m_iCodeProgress == ROLLER_CODE_DIGITS )
{
TaskComplete();
}
else
{
m_flWaitFinished = gpGlobals->curtime + ROLLER_TONE_TIME;
CPASAttenuationFilter filter( this );
EmitSound( filter, entindex(), CHAN_BODY, pCodeSounds[ m_iAccessCode[ m_iCodeProgress ] ], 1.0, ATTN_NORM );
m_iCodeProgress++;
}
}
break;
default:
BaseClass::RunTask( pTask );
break;
}
}
示例7: EmitSound
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CWeaponStriderBuster::BusterPingThink()
{
EmitSound( "Weapon_StriderBuster.Ping" );
SetContextThink( &CWeaponStriderBuster::BusterPingThink, gpGlobals->curtime + BUSTER_PING_SOUND_FREQ, s_pBusterPingThinkContext );
}
示例8: GetPlayerOwner
//.........这里部分代码省略.........
#if !defined( CLIENT_DLL )
CPlantedC4 *pC4 = CPlantedC4::ShootSatchelCharge( pPlayer, pPlayer->GetAbsOrigin(), pPlayer->GetAbsAngles() );
if ( pC4 )
{
pC4->SetBombSiteIndex( pPlayer->m_iBombSiteIndex );
trace_t tr;
UTIL_TraceEntity( pC4, GetAbsOrigin(), GetAbsOrigin() + Vector(0,0,-200), MASK_SOLID, this, COLLISION_GROUP_NONE, &tr );
pC4->SetAbsOrigin( tr.endpos );
CBombTarget *pBombTarget = (CBombTarget*)UTIL_EntityByIndex( pPlayer->m_iBombSiteIndex );
if ( pBombTarget )
{
CBaseEntity *pAttachPoint = gEntList.FindEntityByName( NULL, pBombTarget->GetBombMountTarget() );
if ( pAttachPoint )
{
pC4->SetAbsOrigin( pAttachPoint->GetAbsOrigin() );
pC4->SetAbsAngles( pAttachPoint->GetAbsAngles() );
pC4->SetParent( pAttachPoint );
}
variant_t emptyVariant;
pBombTarget->AcceptInput( "BombPlanted", pC4, pC4, emptyVariant, 0 );
}
}
IGameEvent * event = gameeventmanager->CreateEvent( "bomb_planted" );
if( event )
{
event->SetInt("userid", pPlayer->GetUserID() );
event->SetInt("site", pPlayer->m_iBombSiteIndex );
event->SetInt("posx", pPlayer->GetAbsOrigin().x );
event->SetInt("posy", pPlayer->GetAbsOrigin().y );
event->SetInt( "priority", 8 );
gameeventmanager->FireEvent( event );
}
// Fire a beep event also so the bots have a chance to hear the bomb
event = gameeventmanager->CreateEvent( "bomb_beep" );
if ( event )
{
event->SetInt( "entindex", entindex() );
gameeventmanager->FireEvent( event );
}
pPlayer->SetProgressBarTime( 0 );
CSGameRules()->m_bBombDropped = false;
CSGameRules()->m_bBombPlanted = true;
// Play the plant sound.
Vector plantPosition = pPlayer->GetAbsOrigin() + Vector( 0, 0, 5 );
CPASAttenuationFilter filter( plantPosition );
EmitSound( filter, entindex(), "c4.plant" );
// release the player from being frozen
pPlayer->ResetMaxSpeed();
// No more c4!
pPlayer->Weapon_Drop( this, NULL, NULL );
UTIL_Remove( this );
#endif
//don't allow the planting to start over again next frame.
m_bBombPlanted = true;
return;
}
else
{
ClientPrint( pPlayer, HUD_PRINTCENTER, "#C4_Activated_At_Bomb_Spot" );
#if !defined( CLIENT_DLL )
//pPlayer->SetAnimation( PLAYER_HOLDBOMB );
// release the player from being frozen
pPlayer->ResetMaxSpeed();
IGameEvent * event = gameeventmanager->CreateEvent( "bomb_abortplant" );
if( event )
{
event->SetInt("userid", pPlayer->GetUserID() );
event->SetInt("site", pPlayer->m_iBombSiteIndex );
event->SetInt( "priority", 8 );
gameeventmanager->FireEvent( event );
}
#endif
m_flNextPrimaryAttack = gpGlobals->curtime + 1.0;
return;
}
}
m_flNextPrimaryAttack = gpGlobals->curtime + 0.3;
SetWeaponIdleTime( gpGlobals->curtime + SharedRandomFloat("C4IdleTime", 10, 15 ) );
}
示例9: SetModelName
//-----------------------------------------------------------------------------
// Purpose: Input handler for making the explosion explode.
//-----------------------------------------------------------------------------
void CASWEnvExplosion::InputExplode( inputdata_t &inputdata )
{
trace_t tr;
SetModelName( NULL_STRING );//invisible
SetSolid( SOLID_NONE );// intangible
Vector vecSpot = GetAbsOrigin() + Vector( 0 , 0 , 8 );
UTIL_TraceLine( vecSpot, vecSpot + Vector( 0, 0, -40 ), (MASK_SOLID_BRUSHONLY | MASK_WATER), this, COLLISION_GROUP_NONE, &tr );
// Pull out of the wall a bit. We used to move the explosion origin itself, but that seems unnecessary, not to mention a
// little weird when you consider that it might be in hierarchy. Instead we just calculate a new virtual position at
// which to place the explosion. We don't use that new position to calculate radius damage because according to Steve's
// comment, that adversely affects the force vector imparted on explosion victims when they ragdoll.
Vector vecExplodeOrigin = GetAbsOrigin();
if ( tr.fraction != 1.0 )
{
vecExplodeOrigin = tr.endpos + (tr.plane.normal * 24 );
}
// draw decal
if (! ( m_spawnflags & SF_ENVEXPLOSION_NODECAL ))
{
if ( ! ( m_spawnflags & SF_ENVEXPLOSION_ICE ))
UTIL_DecalTrace( &tr, "Scorch" );
else
UTIL_DecalTrace( &tr, "Ice_Explosion_Decal" );
}
//Get the damage override if specified
float flRadius = ( m_iRadiusOverride > 0 ) ? ((float)m_iRadiusOverride/100.0f) : ( (float)m_iDamage / 100.0f );
// do damage
if ( !( m_spawnflags & SF_ENVEXPLOSION_NODAMAGE ) )
{
CBaseEntity *pAttacker = GetOwnerEntity() ? GetOwnerEntity() : this;
// Only calculate damage type if we didn't get a custom one passed in
int iDamageType = m_iCustomDamageType;
if ( iDamageType == -1 )
{
iDamageType = HasSpawnFlags( SF_ENVEXPLOSION_GENERIC_DAMAGE ) ? DMG_GENERIC : DMG_BLAST;
}
CTakeDamageInfo info( m_hInflictor ? m_hInflictor : this, pAttacker, m_iDamage, iDamageType );
if( HasSpawnFlags( SF_ENVEXPLOSION_SURFACEONLY ) )
{
info.AddDamageType( DMG_BLAST_SURFACE );
}
if ( m_flDamageForce )
{
// Not the right direction, but it'll be fixed up by RadiusDamage.
info.SetDamagePosition( GetAbsOrigin() );
info.SetDamageForce( Vector( m_flDamageForce, 0, 0 ) );
}
ASWGameRules()->RadiusDamage( info, GetAbsOrigin(), flRadius, m_iClassIgnore, m_hEntityIgnore.Get() );
}
// emit the sound
if( !(m_spawnflags & SF_ENVEXPLOSION_NOSOUND) )
{
EmitSound( STRING(m_iszExplosionSound) );
}
// do the particle effect
if( !(m_spawnflags & SF_ENVEXPLOSION_NOFIREBALL) )
{
bool bOnGround = false;
if ( tr.fraction != 1.0 )
bOnGround = true;
UTIL_ASW_EnvExplosionFX( vecExplodeOrigin, flRadius, bOnGround );
}
/*
// do a dlight
if ( !( m_spawnflags & SF_ENVEXPLOSION_NODLIGHTS ) )
{
// Make an elight
dlight_t *el = effects->CL_AllocDlight( LIGHT_INDEX_TE_DYNAMIC + entindex() );
el->origin = vecExplodeOrigin;
el->radius = random->RandomFloat( flRadius + 54.0f, flRadius + 74.0f );
el->decay = el->radius / 0.05f;
el->die = gpGlobals->curtime + 0.05f;
Color c = Color( 255, 192, 64, 6 );
el->color.r = c.r();
el->color.g = c.g();
el->color.b = c.b();
el->color.exponent = c.a();
}
*/
if ( !(m_spawnflags & SF_ENVEXPLOSION_REPEATABLE) )
{
//.........这里部分代码省略.........
示例10: CSGameRules
// Regular explosions
void CPlantedC4::Explode( trace_t *pTrace, int bitsDamageType )
{
// Check to see if the round is over after the bomb went off...
CSGameRules()->m_bTargetBombed = true;
m_bBombTicking = false;
CSGameRules()->CheckWinConditions();
// Do the Damage
float flBombRadius = 500;
if ( g_pMapInfo )
flBombRadius = g_pMapInfo->m_flBombRadius;
// Output to the bomb target ent
CBaseEntity *pTarget = NULL;
variant_t emptyVariant;
while ((pTarget = gEntList.FindEntityByClassname( pTarget, "func_bomb_target" )) != NULL)
{
//Adrian - But only to the one we want!
if ( pTarget->entindex() != m_iBombSiteIndex )
continue;
pTarget->AcceptInput( "BombExplode", this, this, emptyVariant, 0 );
break;
}
// Pull out of the wall a bit
if ( pTrace->fraction != 1.0 )
{
SetAbsOrigin( pTrace->endpos + (pTrace->plane.normal * 0.6) );
}
{
Vector pos = GetAbsOrigin() + Vector( 0,0,8 );
// add an explosion TE so it affects clientside physics
CPASFilter filter( pos );
te->Explosion( filter, 0.0,
&pos,
g_sModelIndexFireball,
50.0,
25,
TE_EXPLFLAG_NONE,
flBombRadius * 3.5,
200 );
}
// Fireball sprite and sound!!
{
Vector fireballPos = GetAbsOrigin();
CPVSFilter filter( fireballPos );
te->Sprite( filter, 0, &fireballPos, g_sModelIndexFireball, 100, 150 );
}
{
Vector fireballPos = GetAbsOrigin() + Vector(
random->RandomFloat( -512, 512 ),
random->RandomFloat( -512, 512 ),
random->RandomFloat( -10, 10 ) );
CPVSFilter filter( fireballPos );
te->Sprite( filter, 0, &fireballPos, g_sModelIndexFireball, 100, 150 );
}
{
Vector fireballPos = GetAbsOrigin() + Vector(
random->RandomFloat( -512, 512 ),
random->RandomFloat( -512, 512 ),
random->RandomFloat( -10, 10 ) );
CPVSFilter filter( fireballPos );
te->Sprite( filter, 0, &fireballPos, g_sModelIndexFireball, 100, 150 );
}
// Sound! for everyone
CBroadcastRecipientFilter filter;
EmitSound( filter, entindex(), "c4.explode" );
// Decal!
UTIL_DecalTrace( pTrace, "Scorch" );
// Shake!
UTIL_ScreenShake( pTrace->endpos, 25.0, 150.0, 1.0, 3000, SHAKE_START );
SetOwnerEntity( NULL ); // can't traceline attack owner if this is set
CSGameRules()->RadiusDamage(
CTakeDamageInfo( this, GetOwnerEntity(), flBombRadius, bitsDamageType ),
GetAbsOrigin(),
flBombRadius * 3.5, //Matt - don't ask me, this is how CS does it.
CLASS_NONE,
true ); // IGNORE THE WORLD!!
// send director message, that something important happed here
/*
MESSAGE_BEGIN( MSG_SPEC, SVC_DIRECTOR );
WRITE_BYTE ( 9 ); // command length in bytes
//.........这里部分代码省略.........
示例11: SetUse
// For CTs to defuse the c4
void CPlantedC4::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
//Can't defuse if its already defused or if it has blown up
if( !m_bBombTicking )
{
SetUse( NULL );
return;
}
CCSPlayer *player = dynamic_cast< CCSPlayer* >( pActivator );
if ( !player || player->GetTeamNumber() != TEAM_CT )
return;
if ( m_bStartDefuse )
{
if ( player != m_pBombDefuser )
{
if ( player->m_iNextTimeCheck < gpGlobals->curtime )
{
ClientPrint( player, HUD_PRINTCENTER, "#Bomb_Already_Being_Defused" );
player->m_iNextTimeCheck = gpGlobals->curtime + 1;
}
return;
}
m_flNextDefuse = gpGlobals->curtime + 0.5;
}
else
{
// freeze the player in place while defusing
player->SetMaxSpeed( 1 );
IGameEvent * event = gameeventmanager->CreateEvent("bomb_begindefuse" );
if( event )
{
event->SetInt( "userid", player->GetUserID() );
if ( player->HasDefuser() )
{
event->SetInt( "haskit", 1 );
// TODO show messages on clients on event
ClientPrint( player, HUD_PRINTCENTER, "#Defusing_Bomb_With_Defuse_Kit" );
}
else
{
event->SetInt( "haskit", 0 );
// TODO show messages on clients on event
ClientPrint( player, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit" );
}
event->SetInt( "priority", 8 );
gameeventmanager->FireEvent( event );
}
Vector soundPosition = player->GetAbsOrigin() + Vector( 0, 0, 5 );
CPASAttenuationFilter filter( soundPosition );
EmitSound( filter, entindex(), "c4.disarmstart" );
m_flDefuseLength = player->HasDefuser() ? 5 : 10;
m_flNextDefuse = gpGlobals->curtime + 0.5;
m_pBombDefuser = player;
m_bStartDefuse = TRUE;
player->m_bIsDefusing = true;
m_flDefuseCountDown = gpGlobals->curtime + m_flDefuseLength;
//start the progress bar
player->SetProgressBarTime( m_flDefuseLength );
}
}
示例12: UTIL_Remove
//.........这里部分代码省略.........
//if the defusing process has not ended yet
if ( m_flDefuseCountDown > gpGlobals->curtime)
{
int iOnGround = FBitSet( m_pBombDefuser->GetFlags(), FL_ONGROUND );
//if the bomb defuser has stopped defusing the bomb
if( m_flNextDefuse < gpGlobals->curtime || !iOnGround )
{
if ( !iOnGround && m_pBombDefuser->IsAlive() )
ClientPrint( m_pBombDefuser, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground");
// release the player from being frozen
m_pBombDefuser->ResetMaxSpeed();
m_pBombDefuser->m_bIsDefusing = false;
#ifndef CLIENT_DLL
// tell the bots someone has aborted defusing
IGameEvent * event = gameeventmanager->CreateEvent( "bomb_abortdefuse" );
if( event )
{
event->SetInt("userid", m_pBombDefuser->GetUserID() );
event->SetInt( "priority", 6 );
gameeventmanager->FireEvent( event );
}
#endif
//cancel the progress bar
m_pBombDefuser->SetProgressBarTime( 0 );
m_pBombDefuser = NULL;
m_bStartDefuse = false;
m_flDefuseCountDown = 0;
m_flDefuseLength = 0; //force it to show completely defused
}
return;
}
//if the defuse process has ended, kill the c4
else if ( !m_pBombDefuser->IsDead() )
{
IGameEvent * event = gameeventmanager->CreateEvent( "bomb_defused" );
if( event )
{
event->SetInt("userid", m_pBombDefuser->GetUserID() );
event->SetInt("site", m_iBombSiteIndex );
event->SetInt( "priority", 9 );
gameeventmanager->FireEvent( event );
}
Vector soundPosition = m_pBombDefuser->GetAbsOrigin() + Vector( 0, 0, 5 );
CPASAttenuationFilter filter( soundPosition );
EmitSound( filter, entindex(), "c4.disarmfinish" );
// The bomb has just been disarmed.. Check to see if the round should end now
m_bBombTicking = false;
// release the player from being frozen
m_pBombDefuser->ResetMaxSpeed();
m_pBombDefuser->m_bIsDefusing = false;
CSGameRules()->m_bBombDefused = true;
CSGameRules()->CheckWinConditions();
// give the defuser credit for defusing the bomb
m_pBombDefuser->IncrementFragCount( 3 );
CSGameRules()->m_bBombDropped = false;
CSGameRules()->m_bBombPlanted = false;
// Clear their progress bar.
m_pBombDefuser->SetProgressBarTime( 0 );
m_pBombDefuser = NULL;
m_bStartDefuse = false;
m_flDefuseLength = 10;
return;
}
#ifndef CLIENT_DLL
// tell the bots someone has aborted defusing
IGameEvent * event = gameeventmanager->CreateEvent( "bomb_abortdefuse" );
if( event )
{
event->SetInt("userid", m_pBombDefuser->GetUserID() );
event->SetInt( "priority", 6 );
gameeventmanager->FireEvent( event );
}
#endif
//if it gets here then the previouse defuser has taken off or been killed
// release the player from being frozen
m_pBombDefuser->ResetMaxSpeed();
m_pBombDefuser->m_bIsDefusing = false;
m_bStartDefuse = false;
m_pBombDefuser = NULL;
}
}
示例13: EmitSound
// Reappear
void CRotatingPickup::Materialize()
{
EmitSound("AlyxEmp.Charge");
m_bRespawning = false;
SetTouch(&CItem::ItemTouch);
}
示例14: switch
//.........这里部分代码省略.........
VectorNormalize( vecSpitDir );
vecSpitDir.x += random->RandomFloat( -0.05, 0.05 );
vecSpitDir.y += random->RandomFloat( -0.05, 0.05 );
vecSpitDir.z += random->RandomFloat( -0.05, 0 );
AttackSound();
CSquidSpit::Shoot( this, vecSpitOffset, vecSpitDir * 900 );
}
}
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->SetAbsVelocity( pHurt->GetAbsVelocity() - (forward * 100) );
pHurt->SetAbsVelocity( pHurt->GetAbsVelocity() + (up * 100) );
pHurt->SetGroundEntity( NULL );
}
}
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 )
{
SetGroundEntity( NULL );
}
// 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 )
{
// croonchy bite sound
CPASAttenuationFilter filter( this );
EmitSound( filter, entindex(), "Bullsquid.Bite" );
// 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 ( pHurt->IsPlayer() )
{
Vector forward, up;
AngleVectors( GetAbsAngles(), &forward, NULL, &up );
pHurt->SetAbsVelocity( pHurt->GetAbsVelocity() + forward * 300 + up * 300 );
}
}
}
break;
default:
BaseClass::HandleAnimEvent( pEvent );
}
}
示例15: EmitSound
//-----------------------------------------------------------------------------
// Purpose:
//
//
// Output :
//-----------------------------------------------------------------------------
void CNPC_Roller::PowerOnSound( void )
{
EmitSound( "NPC_Roller.PowerOn" );
}