Fix animations

Former-commit-id: 20285b42be6f1858105cc4287e357ea254a8ce35
This commit is contained in:
timokoesters 2019-05-19 16:53:07 +02:00
parent b3e4ca0a5d
commit 8af3ca5317
2 changed files with 9 additions and 8 deletions

View File

@ -4,7 +4,7 @@ use vek::*;
// Crate
use crate::{
comp::{phys::Pos, ActionState, ActionEvent, Control, Stats},
comp::{phys::Pos, Animation, AnimationInfo, Control, Stats},
state::DeltaTime,
};
@ -12,14 +12,12 @@ use crate::{
pub struct Sys;
impl<'a> System<'a> for Sys {
type SystemData = (
Read<'a, DeltaTime>,
WriteStorage<'a, ActionState>,
);
type SystemData = (Read<'a, DeltaTime>, WriteStorage<'a, AnimationInfo>);
fn run(&mut self, (dt, mut action_states): Self::SystemData) {
for (dt, mut animation) in (dt, &mut animation).join() {
animation.time += dt.0 as f64;
fn run(&mut self, (dt, mut animation_infos): Self::SystemData) {
for (mut animation_info) in (&mut animation_infos).join() {
animation_info.time += dt.0 as f64;
&animation_info.time;
}
}
}

View File

@ -1,5 +1,6 @@
pub mod action;
pub mod agent;
pub mod animation;
pub mod control;
pub mod phys;
mod stats;
@ -14,6 +15,7 @@ const PHYS_SYS: &str = "phys_sys";
const ANIM_SYS: &str = "anim_sys";
const MOVEMENT_SYS: &str = "movement_sys";
const ACTION_SYS: &str = "action_sys";
const ANIMATION_SYS: &str = "animation_sys";
const STATS_SYS: &str = "stats_sys";
pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) {
@ -23,5 +25,6 @@ pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) {
dispatch_builder.add(anim::Sys, ANIM_SYS, &[]);
dispatch_builder.add(agent::Sys, AGENT_SYS, &[]);
dispatch_builder.add(action::Sys, ACTION_SYS, &[]);
dispatch_builder.add(animation::Sys, ANIMATION_SYS, &[]);
dispatch_builder.add(stats::Sys, STATS_SYS, &[ACTION_SYS]);
}