From 4f058a94e63664b731eb8137a76367b0463d882d Mon Sep 17 00:00:00 2001 From: xill47 Date: Sun, 9 Apr 2023 21:21:05 +0200 Subject: [PATCH] Pressure plate sounds --- src/audio.rs | 92 ++++++++++++++++++++++++------------ src/ui/buttons_styles.rs | 6 +-- src/ui/color_control_view.rs | 6 ++- src/ui/mod.rs | 46 +++++++++++++----- src/ui/wasd.rs | 5 +- 5 files changed, 104 insertions(+), 51 deletions(-) diff --git a/src/audio.rs b/src/audio.rs index 62713fa..385d3f2 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -1,55 +1,87 @@ use bevy::prelude::*; use bevy_ecs_ldtk::GridCoords; -use crate::{levels::tiles::Laser, loading::AudioAssets, player::Player, GameState}; +use crate::{ + levels::panel::PressurePlate, loading::AudioAssets, player::Player, ui::MuteControl, GameState, +}; pub struct InternalAudioPlugin; impl Plugin for InternalAudioPlugin { fn build(&self, app: &mut App) { - app.add_system(start_bgm.in_schedule(OnEnter(GameState::Playing))) - .add_systems((step_audio, laser_audio).in_set(OnUpdate(GameState::Playing))); + app.init_resource::() + .add_system(start_bgm.in_schedule(OnEnter(GameState::Playing))) + .add_systems( + (step_audio, mute_control, bgm_mute_control).in_set(OnUpdate(GameState::Playing)), + ); } } -fn start_bgm(audio_assets: Res, audio: Res