add "woosh" sound effect when opening map

This commit is contained in:
yuni 2024-04-25 03:46:17 +02:00
parent a112b70143
commit d70e22678e
4 changed files with 10 additions and 0 deletions

View file

@ -293,6 +293,7 @@ python -m http.server -d wasm
- https://pixabay.com/sound-effects/high-energy-humming-195612
- https://pixabay.com/sound-effects/box-crash-106687
- https://pixabay.com/sound-effects/electric-fan-motor-blades-removed-13169
- https://pixabay.com/sound-effects/whoosh-blow-flutter-shortwav-14678/
- 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)
- Font Yupiter-Regular.ttf is placed under the SIL OPEN FONT LICENSE Version 1.1 and is based on:

BIN
assets/sounds/woosh.ogg Normal file

Binary file not shown.

View file

@ -16,6 +16,7 @@ use crate::var;
const ASSET_CLICK: &str = "sounds/click-button-140881-crop.ogg";
const ASSET_SWITCH: &str = "sounds/typosonic-typing-192811-crop.ogg";
const ASSET_WOOSH: &str = "sounds/woosh.ogg";
const ASSET_INCOMING_MESSAGE: &str = "sounds/connect.ogg";
const ASSET_PING: &str = "sounds/connect.ogg";
const ASSET_CONNECT: &str = "sounds/connect.ogg";
@ -44,6 +45,7 @@ pub enum Sfx {
IncomingChatMessage,
Click,
Switch,
Woosh,
Ping,
Connect,
EnterVehicle,
@ -62,6 +64,7 @@ pub enum Sfx {
#[derive(Component)] struct SoundBGM(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundClick(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundSwitch(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundWoosh(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundIncomingMessage(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundPing(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundConnect(Handle<AudioSource>);
@ -135,6 +138,7 @@ pub fn setup(
));
commands.insert_resource(SoundClick(asset_server.load(ASSET_CLICK)));
commands.insert_resource(SoundSwitch(asset_server.load(ASSET_SWITCH)));
commands.insert_resource(SoundWoosh(asset_server.load(ASSET_WOOSH)));
commands.insert_resource(SoundIncomingMessage(asset_server.load(ASSET_INCOMING_MESSAGE)));
commands.insert_resource(SoundPing(asset_server.load(ASSET_PING)));
commands.insert_resource(SoundConnect(asset_server.load(ASSET_CONNECT)));
@ -167,6 +171,7 @@ pub fn play_sfx(
mut events_sfx: EventReader<PlaySfxEvent>,
sound_click: Res<SoundClick>,
sound_switch: Res<SoundSwitch>,
sound_woosh: Res<SoundWoosh>,
sound_incoming_message: Res<SoundIncomingMessage>,
sound_ping: Res<SoundPing>,
sound_connect: Res<SoundConnect>,
@ -186,6 +191,7 @@ pub fn play_sfx(
source: match sfx.0 {
Sfx::Switch => sound_switch.0.clone(),
Sfx::Click => sound_click.0.clone(),
Sfx::Woosh => sound_woosh.0.clone(),
Sfx::IncomingChatMessage => sound_incoming_message.0.clone(),
Sfx::Ping => sound_ping.0.clone(),
Sfx::Connect => sound_connect.0.clone(),

View file

@ -291,6 +291,9 @@ pub fn handle_input(
}
if keyboard_input.just_pressed(settings.key_map) {
settings.map_active ^= true;
if settings.map_active {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Woosh));
}
*mapcam = MapCam::default();
ew_updateoverlays.send(hud::UpdateOverlayVisibility);
}