fly_b/
simul.rs

1//! Module containing plugins related to the in-game simulation.
2
3pub mod state;
4
5pub mod observator;
6pub use observator::{bundles::ObservatorBundle, ObservationPlugin};
7
8pub mod hero;
9pub use hero::{
10    bundles::HeroBundle,
11    compos::HeroCore,
12    events::{death::HeroDeath, hop::HeroHop},
13    res::color::HeroColor,
14    HeroPlugin,
15};
16
17pub mod obstacles;
18pub use obstacles::ObstaclesPlugin;
19
20pub mod plane;
21pub use plane::sector::Sector;
22
23pub mod motion;
24pub use motion::{
25    compos::{acceleration::Acceleration, gravitation::Gravitation, velocity::Velocity},
26    res::{gravity::Gravity, scale::MotionScale},
27    MotionPlugin,
28};
29
30#[deprecated]
31#[allow(unused)]
32pub mod emotions;
33#[deprecated]
34pub mod finish;
35#[deprecated]
36pub mod start;
37#[allow(deprecated)]
38pub use emotions::EmotionsPlugin;
39
40use bevy::{app::PluginGroupBuilder, prelude::*};
41
42use crate::{SimulPlanePlugin, SimulStatePlugin};
43
44/// Is meant to contain all the simulation plugins.
45///
46/// These plugins can be configured, set from these interface,
47///  before running the simulation.
48#[allow(missing_docs)]
49#[derive(Default)]
50pub struct SimulPlugins {
51    pub observation: ObservationPlugin,
52    pub hero: HeroPlugin,
53    pub obstacles: ObstaclesPlugin,
54    pub simul_plane: SimulPlanePlugin,
55    pub motion: MotionPlugin,
56    pub simul_state: SimulStatePlugin,
57}
58
59impl PluginGroup for SimulPlugins {
60    fn build(self) -> bevy::app::PluginGroupBuilder {
61        let Self {
62            observation,
63            hero,
64            obstacles,
65            simul_plane: plane,
66            motion,
67            simul_state,
68        } = self;
69        PluginGroupBuilder::start::<Self>()
70            .add(observation)
71            .add(hero)
72            .add(obstacles)
73            .add(plane)
74            .add(motion)
75            .add(simul_state)
76    }
77}