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,34 +13,43 @@ 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),
.add_systems(OnEnter(LinearGameRestart), linear_restart) (setup, spawn_linear_cannon).chain(),
.add_plugins(LinearUIPlugin) )
.configure_sets( .add_systems(OnEnter(LinearGameRestart), linear_restart)
Update, .add_plugins(LinearUIPlugin)
LinearUpdateSet::Track.run_if(in_state(LinearPlayState)), .configure_sets(
) Update,
.add_systems( LinearUpdateSet::Track.run_if(in_state(LinearPlayState)),
Update, ).configure_sets(
( FixedUpdate,
toggle_debug_systems, LinearUpdateSet::Track.run_if(in_state(LinearPlayState)),
draw_track_gizmos, )
draw_grid, .add_systems(
// draw_cannon_laser, Update,
//несколько систем с соблюдением порядка (
calculate_projectile_hits, toggle_debug_systems,
linear_move_projectiles, draw_track_gizmos,
cycle_cannon_balls, draw_grid,
update_linear_cannon_preview, // draw_cannon_laser,
spawn_projectile_from_cannon, //несколько систем с соблюдением порядка
spawn_round_ball, cycle_cannon_balls,
move_round_balls, update_linear_cannon_preview,
rotate_linear_cannon, spawn_projectile_from_cannon,
) rotate_linear_cannon,
.in_set(LinearUpdateSet::Track), ).in_set(LinearUpdateSet::Track),
) )
.add_systems(OnExit(LinearPlayState), cleanup); .add_systems(
FixedUpdate,
(
spawn_round_ball,
move_round_balls,
calculate_projectile_hits,
linear_move_projectiles,
).in_set(LinearUpdateSet::Track),
)
.add_systems(OnExit(LinearPlayState), cleanup);
} }
} }
@ -52,7 +61,7 @@ fn setup(mut commands: Commands) {
commands.insert_resource(precalculated_track); commands.insert_resource(precalculated_track);
commands.insert_resource(build_linear_cannon_state()); commands.insert_resource(build_linear_cannon_state());
let debug_config = LinearDebugConfig{ let debug_config = LinearDebugConfig {
toggle_track: true, toggle_track: true,
toggle_grid: true, toggle_grid: true,
toggle_laser: false, toggle_laser: false,