MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / updateWaterSounds

Method updateWaterSounds

Engine/source/T3D/player.cpp:7182–7215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7180}
7181
7182void Player::updateWaterSounds(F32 dt)
7183{
7184 if ( mWaterCoverage < 1.0f || mDamageState != Enabled )
7185 {
7186 // Stop everything
7187 if ( mMoveBubbleSound )
7188 mMoveBubbleSound->stop();
7189 if ( mWaterBreathSound )
7190 mWaterBreathSound->stop();
7191 return;
7192 }
7193
7194 if ( mMoveBubbleSound )
7195 {
7196 // We're under water and still alive, so let's play something
7197 if ( mVelocity.len() > 1.0f )
7198 {
7199 if ( !mMoveBubbleSound->isPlaying() )
7200 mMoveBubbleSound->play();
7201
7202 mMoveBubbleSound->setTransform( getTransform() );
7203 }
7204 else
7205 mMoveBubbleSound->stop();
7206 }
7207
7208 if ( mWaterBreathSound )
7209 {
7210 if ( !mWaterBreathSound->isPlaying() )
7211 mWaterBreathSound->play();
7212
7213 mWaterBreathSound->setTransform( getTransform() );
7214 }
7215}
7216
7217
7218//--------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 5

stopMethod · 0.45
lenMethod · 0.45
isPlayingMethod · 0.45
playMethod · 0.45
setTransformMethod · 0.45

Tested by

no test coverage detected