Ensure hit beep on last frame of whip
This commit is contained in:
parent
9219b6c475
commit
770793ea68
2 changed files with 15 additions and 3 deletions
|
@ -34,6 +34,7 @@ pub struct SoundEffects {
|
||||||
pub blocked: SoundSamples,
|
pub blocked: SoundSamples,
|
||||||
pub whipping: SoundSamples,
|
pub whipping: SoundSamples,
|
||||||
pub whipping_hit: SoundSamples,
|
pub whipping_hit: SoundSamples,
|
||||||
|
pub whipping_hit_end: SoundSamples,
|
||||||
rng: RandomNumberGenerator,
|
rng: RandomNumberGenerator,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +126,12 @@ impl SoundEffects {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
whipping_hit_end: ss.render_sound_effect(&SoundEffect {
|
||||||
|
sounds: vec![Sound {
|
||||||
|
sound_type: SoundType::Tone(400),
|
||||||
|
duration: Duration::from_millis(20),
|
||||||
|
}],
|
||||||
|
}),
|
||||||
rng: RandomNumberGenerator::new(),
|
rng: RandomNumberGenerator::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,10 @@ impl<'a> System<'a> for WhipSystem {
|
||||||
if let Some(sound) = &mut wants_to_whip.sound {
|
if let Some(sound) = &mut wants_to_whip.sound {
|
||||||
sound.control::<oddio::Stop<_>, _>().stop();
|
sound.control::<oddio::Stop<_>, _>().stop();
|
||||||
}
|
}
|
||||||
|
if wants_to_whip.frame == 7 {
|
||||||
|
wants_to_whip.sound = None;
|
||||||
|
sound_output.play_sound(sound_effects.whipping_hit_end.clone());
|
||||||
|
} else {
|
||||||
wants_to_whip.sound = Some(
|
wants_to_whip.sound = Some(
|
||||||
sound_output.play_sound(sound_effects.whipping_hit.clone()),
|
sound_output.play_sound(sound_effects.whipping_hit.clone()),
|
||||||
);
|
);
|
||||||
|
@ -94,6 +98,7 @@ impl<'a> System<'a> for WhipSystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if wants_to_whip.frame < 7 {
|
if wants_to_whip.frame < 7 {
|
||||||
(*wants_to_whip).frame += 1;
|
(*wants_to_whip).frame += 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue