add achievement sound effect

This commit is contained in:
yuni 2024-05-14 06:37:00 +02:00
parent d20dc5c60d
commit ac38a248fa
4 changed files with 5 additions and 0 deletions

View file

@ -40,6 +40,7 @@
- https://pixabay.com/sound-effects/electric-fan-motor-blades-removed-13169 - https://pixabay.com/sound-effects/electric-fan-motor-blades-removed-13169
- https://pixabay.com/sound-effects/whoosh-blow-flutter-shortwav-14678/ - https://pixabay.com/sound-effects/whoosh-blow-flutter-shortwav-14678/
- https://pixabay.com/sound-effects/dslr-camera-sounds-26117/ - https://pixabay.com/sound-effects/dslr-camera-sounds-26117/
- https://pixabay.com/sound-effects/beep-6-96243
- Music: [Cinematic Cello](https://pixabay.com/music/build-up-scenes-cinematic-cello-115667) by [Aleksey Chistilin](https://pixabay.com/users/lexin_music-28841948/), [Pixabay Content License](https://pixabay.com/service/license-summary) - Music: [Cinematic Cello](https://pixabay.com/music/build-up-scenes-cinematic-cello-115667) by [Aleksey Chistilin](https://pixabay.com/users/lexin_music-28841948/), [Pixabay Content License](https://pixabay.com/service/license-summary)
- Star chart based on the [HYG Stellar database](https://github.com/astronexus/HYG-Database) - Star chart based on the [HYG Stellar database](https://github.com/astronexus/HYG-Database)
- Font Yupiter-Regular.ttf is placed under the SIL OPEN FONT LICENSE Version 1.1 and is based on: - Font Yupiter-Regular.ttf is placed under the SIL OPEN FONT LICENSE Version 1.1 and is based on:

BIN
assets/sounds/achieve.ogg Normal file

Binary file not shown.

View file

@ -41,6 +41,7 @@ const PATHS: &[(SfxType, Sfx, &str)] = &[
(SfxType::LoopSfx, Sfx::Ion, "sounds/ion.ogg"), (SfxType::LoopSfx, Sfx::Ion, "sounds/ion.ogg"),
(SfxType::LoopSfx, Sfx::Rocket, "sounds/rocket.ogg"), (SfxType::LoopSfx, Sfx::Rocket, "sounds/rocket.ogg"),
(SfxType::LoopSfx, Sfx::Thruster, "sounds/thruster.ogg"), (SfxType::LoopSfx, Sfx::Thruster, "sounds/thruster.ogg"),
(SfxType::OneOff, Sfx::Achieve, "sounds/achieve.ogg"),
(SfxType::OneOff, Sfx::Click, "sounds/click-button-140881-crop.ogg"), (SfxType::OneOff, Sfx::Click, "sounds/click-button-140881-crop.ogg"),
(SfxType::OneOff, Sfx::Connect, "sounds/connect.ogg"), (SfxType::OneOff, Sfx::Connect, "sounds/connect.ogg"),
(SfxType::OneOff, Sfx::Crash, "sounds/crash.ogg"), (SfxType::OneOff, Sfx::Crash, "sounds/crash.ogg"),
@ -55,6 +56,7 @@ const PATHS: &[(SfxType, Sfx, &str)] = &[
#[derive(Component, PartialEq, Hash, Eq, Copy, Clone)] #[derive(Component, PartialEq, Hash, Eq, Copy, Clone)]
pub enum Sfx { pub enum Sfx {
Achieve,
BGM, BGM,
Click, Click,
Connect, Connect,
@ -74,6 +76,7 @@ pub enum Sfx {
pub fn str2sfx(sfx_label: &str) -> Sfx { pub fn str2sfx(sfx_label: &str) -> Sfx {
return match sfx_label { return match sfx_label {
"achieve" => Sfx::Achieve,
"switch" => Sfx::Switch, "switch" => Sfx::Switch,
"click" => Sfx::Click, "click" => Sfx::Click,
"woosh" => Sfx::Woosh, "woosh" => Sfx::Woosh,

View file

@ -147,6 +147,7 @@ pub fn handle_game_event(
} }
} }
GameEvent::Achievement(name) => { GameEvent::Achievement(name) => {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Achieve));
log.info(format!("Achievement accomplished: {name}!")); log.info(format!("Achievement accomplished: {name}!"));
} }
} }