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;
|
2022-08-23 14:49:14 +00:00
|
|
|
pub mod volumetric;
|
2022-05-23 16:51:44 +00:00
|
|
|
|
2022-08-06 16:05:04 +00:00
|
|
|
pub use footstep::Footstep;
|
2022-12-20 22:34:37 +00:00
|
|
|
pub use icon::{SoundIcon, SoundIconPlugin};
|
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;
|
|
|
|
for mut sound in sounds.iter_mut() {
|
|
|
|
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
|
|
|
|
2022-12-21 00:49:35 +00:00
|
|
|
impl<'a, S> Default for SoundPlugins<'a, 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())
|
|
|
|
.add(volumetric::VolumetricPlugin)
|
2022-05-23 18:35:25 +00:00
|
|
|
// .add_system(scale_sounds);
|
2022-05-23 16:51:44 +00:00
|
|
|
}
|
|
|
|
}
|