44 lines
1.2 KiB
Rust
44 lines
1.2 KiB
Rust
use bevy::{app::PluginGroupBuilder, prelude::*};
|
|
|
|
pub mod footstep;
|
|
pub mod icon;
|
|
pub mod pitch_shift;
|
|
pub mod volumetric;
|
|
|
|
pub use footstep::{Footstep, Footsteps};
|
|
pub use icon::{SoundIcon, SoundIconPlugin};
|
|
pub use pitch_shift::PitchShiftPlugin;
|
|
pub use volumetric::Volumetric;
|
|
|
|
/*fn scale_sounds(config: Res<CoreConfig>, mut sounds: Query<&mut Sound>) {
|
|
let pixels_per_unit = config.pixels_per_unit as f32;
|
|
for mut sound in &mut sounds {
|
|
sound.reference_distance *= pixels_per_unit;
|
|
if sound.max_distance != f32::MAX {
|
|
sound.max_distance *= pixels_per_unit;
|
|
}
|
|
}
|
|
}*/
|
|
|
|
pub struct SoundPlugins<'a, S>(std::marker::PhantomData<&'a S>);
|
|
|
|
impl<S> Default for SoundPlugins<'_, S> {
|
|
fn default() -> Self {
|
|
Self(std::marker::PhantomData)
|
|
}
|
|
}
|
|
|
|
impl<S> PluginGroup for SoundPlugins<'static, S>
|
|
where
|
|
S: States,
|
|
{
|
|
fn build(self) -> PluginGroupBuilder {
|
|
PluginGroupBuilder::start::<Self>()
|
|
.add(footstep::FootstepPlugin)
|
|
.add(icon::SoundIconPlugin::<S>::default())
|
|
.add(pitch_shift::PitchShiftPlugin::default())
|
|
.add(volumetric::VolumetricPlugin)
|
|
// .add_system(scale_sounds);
|
|
}
|
|
}
|