mute SFX
This commit is contained in:
parent
2361209eab
commit
f069cd7325
|
@ -77,12 +77,14 @@ pub fn setup(
|
|||
},
|
||||
},
|
||||
));
|
||||
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<settings::Settings>,
|
||||
mut events_click: EventReader<AudioClickEvent>,
|
||||
mut events_switch: EventReader<AudioSwitchEvent>,
|
||||
sound_click: Res<SoundClick>,
|
||||
|
@ -120,18 +123,22 @@ pub fn play_sfx(
|
|||
) {
|
||||
if !events_click.is_empty() {
|
||||
events_click.clear();
|
||||
if !settings.mute_sfx {
|
||||
commands.spawn(AudioBundle {
|
||||
source: sound_click.0.clone(),
|
||||
settings: PlaybackSettings::DESPAWN,
|
||||
});
|
||||
}
|
||||
}
|
||||
if !events_switch.is_empty() {
|
||||
events_switch.clear();
|
||||
if !settings.mute_sfx {
|
||||
commands.spawn(AudioBundle {
|
||||
source: sound_switch.0.clone(),
|
||||
settings: PlaybackSettings::DESPAWN,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_music(
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue