This commit is contained in:
yuni 2024-09-17 16:41:08 +02:00
parent 3e8d4bf6d7
commit 2876266008
3 changed files with 14 additions and 15 deletions

View file

@ -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::<FadeMaterial>();
}
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::<Grow3DObject>();
}
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);

View file

@ -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::<RespawnEvent>()));
app.add_systems(Update, handle_despawn_at.run_if(any_with_component::<DespawnAt>));
app.add_systems(
Update,
handle_despawn_at.run_if(any_with_component::<DespawnAt>),
);
app.add_plugins(PhysicsPlugins::default());
//app.add_plugins(PhysicsDebugPlugin::default());
app.insert_resource(Gravity(DVec3::splat(0.0)));