2022-12-21 00:49:35 +00:00
|
|
|
use bevy::{app::PluginGroupBuilder, prelude::*};
|
2022-05-23 16:51:44 +00:00
|
|
|
|
|
|
|
pub mod footstep;
|
|
|
|
pub mod icon;
|
2023-03-28 17:16:38 +00:00
|
|
|
pub mod pitch_shift;
|
2022-08-23 14:49:14 +00:00
|
|
|
pub mod volumetric;
|
2022-05-23 16:51:44 +00:00
|
|
|
|
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;
|
2022-08-23 14:49:14 +00:00
|
|
|
pub use volumetric::Volumetric;
|
2022-05-23 16:51:44 +00:00
|
|
|
|
2022-05-23 18:35:25 +00:00
|
|
|
/*fn scale_sounds(config: Res<CoreConfig>, mut sounds: Query<&mut Sound>) {
|
2022-05-23 16:51:44 +00:00
|
|
|
let pixels_per_unit = config.pixels_per_unit as f32;
|
2023-03-28 17:13:23 +00:00
|
|
|
for mut sound in &mut sounds {
|
2022-05-23 16:51:44 +00:00
|
|
|
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-05-23 16:51:44 +00:00
|
|
|
|
2022-12-21 00:49:35 +00:00
|
|
|
pub struct SoundPlugins<'a, S>(std::marker::PhantomData<&'a S>);
|
2022-05-23 16:51:44 +00:00
|
|
|
|
2024-12-03 16:15:11 +00:00
|
|
|
impl<S> Default for SoundPlugins<'_, S> {
|
2022-05-23 16:51:44 +00:00
|
|
|
fn default() -> Self {
|
|
|
|
Self(std::marker::PhantomData)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-21 00:49:35 +00:00
|
|
|
impl<S> PluginGroup for SoundPlugins<'static, S>
|
2022-05-23 16:51:44 +00:00
|
|
|
where
|
2023-03-28 16:57:37 +00:00
|
|
|
S: States,
|
2022-05-23 16:51:44 +00:00
|
|
|
{
|
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);
|
2022-05-23 16:51:44 +00:00
|
|
|
}
|
|
|
|
}
|