add impaler scaffolding and teams
This commit is contained in:
parent
af45237701
commit
6659fe8e5a
12 changed files with 151 additions and 21 deletions
|
|
@ -13,6 +13,7 @@ impl Plugin for StatePlugin {
|
|||
.enable_state_scoped_entities::<AppState>()
|
||||
.add_sub_state::<GameState>()
|
||||
.enable_state_scoped_entities::<GameState>()
|
||||
.add_sub_state::<Phase>()
|
||||
.configure_sets(
|
||||
FixedUpdate,
|
||||
GameSystemSet::LoadingTick.run_if(in_state(GameState::Loading)),
|
||||
|
|
@ -22,8 +23,20 @@ impl Plugin for StatePlugin {
|
|||
(
|
||||
// these all run before physics, which is in FixedPostUpdate by default
|
||||
GameSystemSet::PreTick,
|
||||
(
|
||||
GameSystemSet::PrePlan.run_if(in_state(Phase::Plan)),
|
||||
GameSystemSet::PreExecute.run_if(in_state(Phase::Execute)),
|
||||
),
|
||||
GameSystemSet::Tick,
|
||||
(
|
||||
GameSystemSet::Plan.run_if(in_state(Phase::Plan)),
|
||||
GameSystemSet::Execute.run_if(in_state(Phase::Execute)),
|
||||
),
|
||||
GameSystemSet::PostTick,
|
||||
(
|
||||
GameSystemSet::PostPlan.run_if(in_state(Phase::Plan)),
|
||||
GameSystemSet::PostExecute.run_if(in_state(Phase::Execute)),
|
||||
),
|
||||
)
|
||||
.run_if(in_state(GameState::Running))
|
||||
.chain(),
|
||||
|
|
@ -65,8 +78,27 @@ pub enum GameState {
|
|||
Paused,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Hash, SubStates, Default)]
|
||||
#[source(GameState = GameState::Running)]
|
||||
pub enum Phase {
|
||||
#[default]
|
||||
Execute,
|
||||
Plan,
|
||||
}
|
||||
|
||||
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone)]
|
||||
pub enum GameSystemSet {
|
||||
// fixed update - contains all gameplay logic. does not run when game is paused
|
||||
LoadingTick,
|
||||
PreTick,
|
||||
PreExecute,
|
||||
PrePlan,
|
||||
Tick,
|
||||
Execute,
|
||||
Plan,
|
||||
PostTick,
|
||||
PostExecute,
|
||||
PostPlan,
|
||||
// runs even if game is not loaded/active
|
||||
UpdateInputs,
|
||||
UI,
|
||||
|
|
@ -74,11 +106,6 @@ pub enum GameSystemSet {
|
|||
PreUpdate,
|
||||
Update,
|
||||
PostUpdate,
|
||||
// fixed update - contains all gameplay logic. does not run when game is paused
|
||||
LoadingTick,
|
||||
PreTick,
|
||||
Tick,
|
||||
PostTick,
|
||||
}
|
||||
|
||||
fn start_physics(mut time: ResMut<Time<Physics>>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue