add 'thunder_rate' weather property
This commit is contained in:
@@ -178,6 +178,26 @@ void Decorator::update(
|
||||
const WeatherPreset& weatherA,
|
||||
const WeatherPreset& weatherB
|
||||
) {
|
||||
float thunderRate = weatherA.thunderRate * weatherA.intensity +
|
||||
weatherB.thunderRate * weatherB.intensity;
|
||||
thunderTimer += delta;
|
||||
util::PseudoRandom random(rand());
|
||||
if (thunderTimer >= 1.0f) {
|
||||
thunderTimer = 0.0f;
|
||||
if (random.randFloat() < thunderRate) {
|
||||
audio::play(
|
||||
assets.get<audio::Sound>("ambient/thunder"),
|
||||
glm::vec3(),
|
||||
false,
|
||||
1.0f,
|
||||
1.0f + random.randFloat() - 0.5f,
|
||||
false,
|
||||
audio::PRIORITY_NORMAL,
|
||||
audio::get_channel_index("ambient")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
glm::ivec3 pos = camera.position;
|
||||
for (int i = 0; i < ITERATIONS; i++) {
|
||||
update(delta, pos - glm::ivec3(UPDATE_AREA_DIAMETER / 2), pos);
|
||||
|
||||
Reference in New Issue
Block a user