3 #include <BLIB/Audio/AudioSystem.hpp>
4 #include <BLIB/Events.hpp>
5 #include <BLIB/Util/Random.hpp>
19 float computeAlpha(
float time) {
21 const float x = time - 0.2f;
22 return -1000.f * x * x + 225;
24 const float x = (time - 0.5f) - 0.2f;
25 return -550.f * x * x + 200;
31 , minInterval(f ?
Properties::FrequentThunderMinInterval() :
33 , maxInterval(f ?
Properties::FrequentThunderMaxInterval() :
35 , timeSinceLastThunder(0.f)
46 timeSinceLastThunder += dt;
48 if (bl::util::Random::get<float>(minInterval, maxInterval) <= timeSinceLastThunder) {
49 timeSinceLastThunder = 0.f;
50 bl::audio::AudioSystem::playSound(sound);
51 bl::event::Dispatcher::dispatch<event::Thundered>({});
Core classes and functionality for both the editor and game.
Wrapper around bl::engine::Configuration. Provides application configuration in variables that may be...
static const std::string & ThunderSoundFile()
void stop()
Prevents further thunder and fades out current strike if present.
void update(float dt)
Update the thunder.
~Thunder()
Stops the thunder sound.
Thunder(bool enabled, bool frequent)
Construct a new Thunder object.