Switch to PluginGroup.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nolan Darilek 2022-12-20 18:49:35 -06:00
parent aa054c3637
commit 4ecacb73ad

View File

@ -1,8 +1,6 @@
use std::{fmt::Debug, hash::Hash};
use bevy::prelude::*;
use crate::core::CoreConfig;
use bevy::{app::PluginGroupBuilder, prelude::*};
pub mod footstep;
pub mod icon;
@ -22,28 +20,23 @@ pub use volumetric::Volumetric;
}
}*/
pub struct SoundPlugin<'a, S>(std::marker::PhantomData<&'a S>);
pub struct SoundPlugins<'a, S>(std::marker::PhantomData<&'a S>);
impl<'a, S> Default for SoundPlugin<'a, S> {
impl<'a, S> Default for SoundPlugins<'a, S> {
fn default() -> Self {
Self(std::marker::PhantomData)
}
}
impl<S> Plugin for SoundPlugin<'static, S>
impl<S> PluginGroup for SoundPlugins<'static, S>
where
S: 'static + Clone + Debug + Eq + Hash + Send + Sync,
{
fn build(&self, app: &mut App) {
let _core_config = *app.world.get_resource::<CoreConfig>().unwrap();
/*if let Some(context) = app.world.get_resource::<Context>() {
context
.set_meters_per_unit(1. / core_config.pixels_per_unit as f32)
.unwrap();
}*/
app.add_plugin(footstep::FootstepPlugin)
.add_plugin(icon::SoundIconPlugin::<S>::default())
.add_plugin(volumetric::VolumetricPlugin);
fn build(self) -> PluginGroupBuilder {
PluginGroupBuilder::start::<Self>()
.add(footstep::FootstepPlugin)
.add(icon::SoundIconPlugin::<S>::default())
.add(volumetric::VolumetricPlugin)
// .add_system(scale_sounds);
}
}