mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
26 lines
576 B
Rust
26 lines
576 B
Rust
|
// Library
|
||
|
use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage};
|
||
|
use vek::*;
|
||
|
|
||
|
// Crate
|
||
|
use crate::{
|
||
|
comp::{phys::Pos, ActionState, ActionEvent, Control, Stats},
|
||
|
state::DeltaTime,
|
||
|
};
|
||
|
|
||
|
// Basic ECS AI agent system
|
||
|
pub struct Sys;
|
||
|
|
||
|
impl<'a> System<'a> for Sys {
|
||
|
type SystemData = (
|
||
|
Read<'a, DeltaTime>,
|
||
|
WriteStorage<'a, ActionState>,
|
||
|
);
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
}
|