Skip to content

Commit

Permalink
Use startup system for schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
Indy2222 committed Jul 24, 2023
1 parent 1401bb9 commit 0cf46d9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions crates/core/src/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ pub struct GameSchedulesPlugin;

impl Plugin for GameSchedulesPlugin {
fn build(&self, app: &mut App) {
let mut main = app.world.get_resource_mut::<MainScheduleOrder>().unwrap();

main.insert_after(First, InputSchedule);
main.insert_after(InputSchedule, PreMovement);
main.insert_after(PreMovement, Movement);
main.insert_after(Movement, PostMovement);
app.add_systems(Startup, setup);
}
}

fn setup(mut main: ResMut<MainScheduleOrder>) {
main.insert_after(First, InputSchedule);
main.insert_after(InputSchedule, PreMovement);
main.insert_after(PreMovement, Movement);
main.insert_after(Movement, PostMovement);
}

/// All user input is handled during this schedule.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
pub struct InputSchedule;
Expand Down

0 comments on commit 0cf46d9

Please sign in to comment.