diff --git a/src/audio.rs b/src/audio.rs index fd1dee1..5fb2242 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -77,12 +77,14 @@ pub fn setup( }, }, )); - commands.spawn(( - AudioBundle { - source: asset_server.load("sounds/wakeup.ogg"), - settings: PlaybackSettings::DESPAWN, - }, - )); + if !settings.mute_sfx { + commands.spawn(( + AudioBundle { + source: asset_server.load("sounds/wakeup.ogg"), + settings: PlaybackSettings::DESPAWN, + }, + )); + } commands.spawn(( ComponentThrusterSound, AudioBundle { @@ -113,6 +115,7 @@ pub fn toggle_bgm( pub fn play_sfx( mut commands: Commands, + settings: Res, mut events_click: EventReader, mut events_switch: EventReader, sound_click: Res, @@ -120,17 +123,21 @@ pub fn play_sfx( ) { if !events_click.is_empty() { events_click.clear(); - commands.spawn(AudioBundle { - source: sound_click.0.clone(), - settings: PlaybackSettings::DESPAWN, - }); + if !settings.mute_sfx { + commands.spawn(AudioBundle { + source: sound_click.0.clone(), + settings: PlaybackSettings::DESPAWN, + }); + } } if !events_switch.is_empty() { events_switch.clear(); - commands.spawn(AudioBundle { - source: sound_switch.0.clone(), - settings: PlaybackSettings::DESPAWN, - }); + if !settings.mute_sfx { + commands.spawn(AudioBundle { + source: sound_switch.0.clone(), + settings: PlaybackSettings::DESPAWN, + }); + } } } diff --git a/src/settings.rs b/src/settings.rs index 6834637..3e77ab0 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -15,8 +15,8 @@ pub struct Settings { impl Default for Settings { fn default() -> Self { Settings { - mute_sfx: false, - mute_music: false, + mute_sfx: true, + mute_music: true, volume_sfx: 100, volume_music: 100, font_size_hud: 32.0,