Don't start rain sound too early
This commit is contained in:
parent
d8f61e336e
commit
507d9566a0
@ -31,12 +31,6 @@ Rain::Rain()
|
||||
m_thunder_sound = sfx_manager->createSoundSource("thunder");
|
||||
m_rain_sound = sfx_manager->createSoundSource("rain");
|
||||
|
||||
if (m_rain_sound)
|
||||
{
|
||||
m_rain_sound->setLoop(true);
|
||||
m_rain_sound->play();
|
||||
}
|
||||
|
||||
RandomGenerator g;
|
||||
m_next_lightning = (float)g.get(35);
|
||||
} // Rain
|
||||
@ -71,3 +65,14 @@ void Rain::update(float dt)
|
||||
m_next_lightning = 35 + (float)g.get(35);
|
||||
}
|
||||
} // update
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void Rain::playSound()
|
||||
{
|
||||
if (m_rain_sound)
|
||||
{
|
||||
m_rain_sound->setLoop(true);
|
||||
m_rain_sound->play();
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
virtual ~Rain();
|
||||
|
||||
void update(float dt);
|
||||
void playSound();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -348,6 +348,9 @@ public:
|
||||
void setNetworkWorld(bool is_networked) { m_is_network_world = is_networked; }
|
||||
|
||||
bool isNetworkWorld() const { return m_is_network_world; }
|
||||
|
||||
/** Returns a pointer to the rain. */
|
||||
Rain* getRain() {return m_rain;}
|
||||
}; // World
|
||||
|
||||
#endif
|
||||
|
@ -130,10 +130,17 @@ void WorldStatus::update(const float dt)
|
||||
case SETUP_PHASE:
|
||||
m_auxiliary_timer = 0.0f;
|
||||
m_phase = TRACK_INTRO_PHASE;
|
||||
|
||||
if (m_play_racestart_sounds)
|
||||
{
|
||||
m_track_intro_sound->play();
|
||||
}
|
||||
|
||||
if (World::getWorld()->getRain() != NULL)
|
||||
{
|
||||
World::getWorld()->getRain()->playSound();
|
||||
}
|
||||
|
||||
return;
|
||||
case TRACK_INTRO_PHASE:
|
||||
m_auxiliary_timer += dt;
|
||||
|
Loading…
x
Reference in New Issue
Block a user