2019-06-06 14:48:41 +00:00
|
|
|
use crate::{comp::AnimationInfo, state::DeltaTime};
|
|
|
|
use specs::{Join, Read, System, WriteStorage};
|
2019-05-17 20:47:58 +00:00
|
|
|
|
|
|
|
// Basic ECS AI agent system
|
|
|
|
pub struct Sys;
|
|
|
|
|
|
|
|
impl<'a> System<'a> for Sys {
|
2019-05-19 14:53:07 +00:00
|
|
|
type SystemData = (Read<'a, DeltaTime>, WriteStorage<'a, AnimationInfo>);
|
2019-05-17 20:47:58 +00:00
|
|
|
|
2019-05-19 14:53:07 +00:00
|
|
|
fn run(&mut self, (dt, mut animation_infos): Self::SystemData) {
|
2019-06-06 14:48:41 +00:00
|
|
|
for mut animation_info in (&mut animation_infos).join() {
|
2019-05-19 14:53:07 +00:00
|
|
|
animation_info.time += dt.0 as f64;
|
2019-05-17 20:47:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|