blackout/src/sound/mod.rs

44 lines
1.2 KiB
Rust
Raw Normal View History

2022-12-21 00:49:35 +00:00
use bevy::{app::PluginGroupBuilder, prelude::*};
pub mod footstep;
pub mod icon;
2023-03-28 17:16:38 +00:00
pub mod pitch_shift;
pub mod volumetric;
2023-04-03 16:56:27 +00:00
pub use footstep::{Footstep, Footsteps};
2022-12-20 22:34:37 +00:00
pub use icon::{SoundIcon, SoundIconPlugin};
2023-03-28 17:16:38 +00:00
pub use pitch_shift::PitchShiftPlugin;
pub use volumetric::Volumetric;
2022-05-23 18:35:25 +00:00
/*fn scale_sounds(config: Res<CoreConfig>, mut sounds: Query<&mut Sound>) {
let pixels_per_unit = config.pixels_per_unit as f32;
2023-03-28 17:13:23 +00:00
for mut sound in &mut sounds {
sound.reference_distance *= pixels_per_unit;
if sound.max_distance != f32::MAX {
sound.max_distance *= pixels_per_unit;
}
}
2022-05-23 18:35:25 +00:00
}*/
2022-12-21 00:49:35 +00:00
pub struct SoundPlugins<'a, S>(std::marker::PhantomData<&'a S>);
2022-12-21 00:49:35 +00:00
impl<'a, S> Default for SoundPlugins<'a, S> {
fn default() -> Self {
Self(std::marker::PhantomData)
}
}
2022-12-21 00:49:35 +00:00
impl<S> PluginGroup for SoundPlugins<'static, S>
where
2023-03-28 16:57:37 +00:00
S: States,
{
2022-12-21 00:49:35 +00:00
fn build(self) -> PluginGroupBuilder {
PluginGroupBuilder::start::<Self>()
.add(footstep::FootstepPlugin)
.add(icon::SoundIconPlugin::<S>::default())
2023-03-28 17:16:38 +00:00
.add(pitch_shift::PitchShiftPlugin::default())
2022-12-21 00:49:35 +00:00
.add(volumetric::VolumetricPlugin)
2022-05-23 18:35:25 +00:00
// .add_system(scale_sounds);
}
}