From 28762660084620e6980391cf1a4c5068805dcf08 Mon Sep 17 00:00:00 2001 From: yuni Date: Tue, 17 Sep 2024 16:41:08 +0200 Subject: [PATCH] cleanup --- src/game.rs | 12 ++++++------ src/visual.rs | 12 ++++-------- src/world.rs | 5 ++++- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/game.rs b/src/game.rs index d7bfdaa..793bda6 100644 --- a/src/game.rs +++ b/src/game.rs @@ -481,7 +481,7 @@ fn debug( keyboard_input: Res>, // mut commands: Commands, // mut extended_materials: ResMut< - // Assets>, + // Assets>, // >, mut achievement_tracker: ResMut, vars: Res, @@ -490,11 +490,11 @@ fn debug( if settings.dev_mode && keyboard_input.just_pressed(KeyCode::KeyP) { // for (entity, _name, mesh) in &materials { - // dbg!(mesh); - // let mut entity = commands.entity(entity); - // entity.remove::>(); - // let material = extended_materials.add(load::AsteroidSurface::material()); - // entity.insert(material); + // dbg!(mesh); + // let mut entity = commands.entity(entity); + // entity.remove::>(); + // let material = extended_materials.add(load::AsteroidSurface::material()); + // entity.insert(material); // } } if settings.dev_mode && keyboard_input.just_pressed(KeyCode::KeyN) { diff --git a/src/visual.rs b/src/visual.rs index 2d2099e..b498648 100644 --- a/src/visual.rs +++ b/src/visual.rs @@ -265,11 +265,9 @@ pub fn update_fade_material( if now > end_time { material.base_color.set_alpha(data.value_end); commands.entity(entity).remove::(); - } - else if now < data.start_time { + } else if now < data.start_time { material.base_color.set_alpha(data.value_start); - } - else { + } else { let progress = ((now - data.start_time) / data.duration) as f32; let value = data.value_start + progress * (data.value_end - data.value_start); material.base_color.set_alpha(value); @@ -288,11 +286,9 @@ pub fn update_grow( if now > end_time { trans.scale = Vec3::splat(data.scale_end); commands.entity(entity).remove::(); - } - else if now < data.start_time { + } else if now < data.start_time { trans.scale = Vec3::splat(data.scale_start); - } - else { + } else { let progress = ((now - data.start_time) / data.duration) as f32; let scale = data.scale_start + progress * (data.scale_end - data.scale_start); trans.scale = Vec3::splat(scale); diff --git a/src/world.rs b/src/world.rs index 1a7311e..4bca800 100644 --- a/src/world.rs +++ b/src/world.rs @@ -38,7 +38,10 @@ impl Plugin for WorldPlugin { fn build(&self, app: &mut App) { app.add_systems(Startup, setup); app.add_systems(Update, handle_respawn.run_if(on_event::())); - app.add_systems(Update, handle_despawn_at.run_if(any_with_component::)); + app.add_systems( + Update, + handle_despawn_at.run_if(any_with_component::), + ); app.add_plugins(PhysicsPlugins::default()); //app.add_plugins(PhysicsDebugPlugin::default()); app.insert_resource(Gravity(DVec3::splat(0.0)));