diff --git a/src/audio.rs b/src/audio.rs index afa854d..8526266 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -1,110 +1,101 @@ -use crate::config::GameConfig; -use crate::AppSet; +//! Exposes a plugin that starts, stops, and modulates in-game audio when events are emitted +use crate::assets::audio_assets::GameAudioAssets; +use crate::components::audio::{ChangeBackgroundMusicEvent, PlaySoundEffectEvent}; use bevy::prelude::*; use bevy_kira_audio::prelude::*; -use std::time::Duration; -const SPATIAL_AUDIO_MAX_DISTANCE: f32 = 400.0; +/// Starts, stops, and modulates in-game audio when we receive a `PlaySoundEffectEvent` or `ChangeBackgroundMusicEvent`. +pub(super) fn plugin(app: &mut App) { + app.add_event::(); + app.add_event::(); -pub fn play_sound_effects( - audio: &Res