moved critical systems to fixed update schedule

This commit is contained in:
nquidox 2026-04-18 21:55:27 +03:00
parent f502cdb0ce
commit eeebdbd272

View file

@ -13,13 +13,18 @@ pub enum LinearUpdateSet {
impl Plugin for LinearPlayPlugin { impl Plugin for LinearPlayPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app app.add_systems(
.add_systems(OnEnter(LinearPlayState), (setup, spawn_linear_cannon).chain()) OnEnter(LinearPlayState),
(setup, spawn_linear_cannon).chain(),
)
.add_systems(OnEnter(LinearGameRestart), linear_restart) .add_systems(OnEnter(LinearGameRestart), linear_restart)
.add_plugins(LinearUIPlugin) .add_plugins(LinearUIPlugin)
.configure_sets( .configure_sets(
Update, Update,
LinearUpdateSet::Track.run_if(in_state(LinearPlayState)), LinearUpdateSet::Track.run_if(in_state(LinearPlayState)),
).configure_sets(
FixedUpdate,
LinearUpdateSet::Track.run_if(in_state(LinearPlayState)),
) )
.add_systems( .add_systems(
Update, Update,
@ -29,16 +34,20 @@ impl Plugin for LinearPlayPlugin {
draw_grid, draw_grid,
// draw_cannon_laser, // draw_cannon_laser,
//несколько систем с соблюдением порядка //несколько систем с соблюдением порядка
calculate_projectile_hits,
linear_move_projectiles,
cycle_cannon_balls, cycle_cannon_balls,
update_linear_cannon_preview, update_linear_cannon_preview,
spawn_projectile_from_cannon, spawn_projectile_from_cannon,
rotate_linear_cannon,
).in_set(LinearUpdateSet::Track),
)
.add_systems(
FixedUpdate,
(
spawn_round_ball, spawn_round_ball,
move_round_balls, move_round_balls,
rotate_linear_cannon, calculate_projectile_hits,
) linear_move_projectiles,
.in_set(LinearUpdateSet::Track), ).in_set(LinearUpdateSet::Track),
) )
.add_systems(OnExit(LinearPlayState), cleanup); .add_systems(OnExit(LinearPlayState), cleanup);
} }