2019-05-17 20:47:58 +00:00
|
|
|
// Library
|
|
|
|
use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage};
|
|
|
|
use vek::*;
|
|
|
|
|
|
|
|
// Crate
|
|
|
|
use crate::{
|
2019-05-22 20:53:24 +00:00
|
|
|
comp::{phys::Pos, Animation, AnimationInfo, Stats},
|
2019-05-17 20:47:58 +00:00
|
|
|
state::DeltaTime,
|
|
|
|
};
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
for (mut animation_info) in (&mut animation_infos).join() {
|
|
|
|
animation_info.time += dt.0 as f64;
|
2019-05-17 20:47:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|