moved critical systems to fixed update schedule
This commit is contained in:
parent
f502cdb0ce
commit
eeebdbd272
1 changed files with 39 additions and 30 deletions
|
|
@ -13,34 +13,43 @@ pub enum LinearUpdateSet {
|
|||
|
||||
impl Plugin for LinearPlayPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app
|
||||
.add_systems(OnEnter(LinearPlayState), (setup, spawn_linear_cannon).chain())
|
||||
.add_systems(OnEnter(LinearGameRestart), linear_restart)
|
||||
.add_plugins(LinearUIPlugin)
|
||||
.configure_sets(
|
||||
Update,
|
||||
LinearUpdateSet::Track.run_if(in_state(LinearPlayState)),
|
||||
)
|
||||
.add_systems(
|
||||
Update,
|
||||
(
|
||||
toggle_debug_systems,
|
||||
draw_track_gizmos,
|
||||
draw_grid,
|
||||
// draw_cannon_laser,
|
||||
//несколько систем с соблюдением порядка
|
||||
calculate_projectile_hits,
|
||||
linear_move_projectiles,
|
||||
cycle_cannon_balls,
|
||||
update_linear_cannon_preview,
|
||||
spawn_projectile_from_cannon,
|
||||
spawn_round_ball,
|
||||
move_round_balls,
|
||||
rotate_linear_cannon,
|
||||
)
|
||||
.in_set(LinearUpdateSet::Track),
|
||||
)
|
||||
.add_systems(OnExit(LinearPlayState), cleanup);
|
||||
app.add_systems(
|
||||
OnEnter(LinearPlayState),
|
||||
(setup, spawn_linear_cannon).chain(),
|
||||
)
|
||||
.add_systems(OnEnter(LinearGameRestart), linear_restart)
|
||||
.add_plugins(LinearUIPlugin)
|
||||
.configure_sets(
|
||||
Update,
|
||||
LinearUpdateSet::Track.run_if(in_state(LinearPlayState)),
|
||||
).configure_sets(
|
||||
FixedUpdate,
|
||||
LinearUpdateSet::Track.run_if(in_state(LinearPlayState)),
|
||||
)
|
||||
.add_systems(
|
||||
Update,
|
||||
(
|
||||
toggle_debug_systems,
|
||||
draw_track_gizmos,
|
||||
draw_grid,
|
||||
// draw_cannon_laser,
|
||||
//несколько систем с соблюдением порядка
|
||||
cycle_cannon_balls,
|
||||
update_linear_cannon_preview,
|
||||
spawn_projectile_from_cannon,
|
||||
rotate_linear_cannon,
|
||||
).in_set(LinearUpdateSet::Track),
|
||||
)
|
||||
.add_systems(
|
||||
FixedUpdate,
|
||||
(
|
||||
spawn_round_ball,
|
||||
move_round_balls,
|
||||
calculate_projectile_hits,
|
||||
linear_move_projectiles,
|
||||
).in_set(LinearUpdateSet::Track),
|
||||
)
|
||||
.add_systems(OnExit(LinearPlayState), cleanup);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -51,8 +60,8 @@ fn setup(mut commands: Commands) {
|
|||
commands.insert_resource(build_track);
|
||||
commands.insert_resource(precalculated_track);
|
||||
commands.insert_resource(build_linear_cannon_state());
|
||||
|
||||
let debug_config = LinearDebugConfig{
|
||||
|
||||
let debug_config = LinearDebugConfig {
|
||||
toggle_track: true,
|
||||
toggle_grid: true,
|
||||
toggle_laser: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue