mgd2-tram-championships/src/game.rs

24 lines
621 B
Rust
Raw Normal View History

use bevy::prelude::*;
use crate::{
AppState,
cleanup::{self, despawn},
};
mod camera;
mod scene;
/// Gameplay system set. All functions in this control the gameplay (duh).
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
struct GameplaySet;
pub fn plugin(app: &mut App) {
app.add_plugins(camera::plugin)
.add_systems(OnEnter(AppState::Ingame), scene::setup.in_set(GameplaySet))
.add_systems(
OnExit(AppState::Ingame),
despawn::<cleanup::Scene>.in_set(GameplaySet),
);
app.configure_sets(Update, GameplaySet.run_if(in_state(AppState::Ingame)));
}