Fix invisible characters

This commit is contained in:
timokoesters 2019-06-29 20:23:18 +02:00
parent c80351f6ca
commit 9f83533741
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097
2 changed files with 5 additions and 12 deletions

View File

@ -16,7 +16,6 @@ pub enum Animation {
pub struct AnimationInfo {
pub animation: Animation,
pub time: f64,
pub changed: bool,
}
impl Default for AnimationInfo {
@ -24,7 +23,6 @@ impl Default for AnimationInfo {
Self {
animation: Animation::Idle,
time: 0.0,
changed: true,
}
}
}

View File

@ -25,15 +25,12 @@ impl<'a> System<'a> for Sys {
mut animation_infos,
): Self::SystemData,
) {
for (entity, a, mut animation_info) in (
for (entity, a) in (
&entities,
&action_states,
&mut animation_infos,
)
.join()
{
animation_info.time += dt.0 as f64;
fn impossible_animation(message: &str) -> Animation {
warn!("{}", message);
Animation::Idle
@ -58,14 +55,12 @@ impl<'a> System<'a> for Sys {
(_, _, true, false, false) => Animation::Attack,
};
let last = animation_info.clone();
let changed = last.animation != animation;
let new_time = animation_infos.get(entity).filter(|i| i.animation == animation).map(|i| i.time + dt.0 as f64);
*animation_info = AnimationInfo {
animation_infos.insert(entity, AnimationInfo {
animation,
time: if changed { 0.0 } else { last.time },
changed,
};
time: new_time.unwrap_or(0.0),
});
}
}
}