2020-01-21 22:54:32 +00:00
|
|
|
use super::utils::*;
|
|
|
|
use crate::comp::{EcsStateData, StateUpdate};
|
2019-12-28 16:10:39 +00:00
|
|
|
|
2020-01-12 23:06:52 +00:00
|
|
|
use crate::states::StateHandler;
|
2020-01-05 18:19:09 +00:00
|
|
|
#[derive(Clone, Copy, Default, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
|
2020-01-08 16:56:36 +00:00
|
|
|
pub struct State;
|
2019-12-28 16:10:39 +00:00
|
|
|
|
2020-01-08 16:56:36 +00:00
|
|
|
impl StateHandler for State {
|
2020-01-07 15:49:08 +00:00
|
|
|
fn new(_ecs_data: &EcsStateData) -> Self {
|
2020-01-05 23:17:22 +00:00
|
|
|
Self {}
|
|
|
|
}
|
|
|
|
|
2019-12-28 16:10:39 +00:00
|
|
|
fn handle(&self, ecs_data: &EcsStateData) -> StateUpdate {
|
|
|
|
let mut update = StateUpdate {
|
|
|
|
character: *ecs_data.character,
|
|
|
|
pos: *ecs_data.pos,
|
|
|
|
vel: *ecs_data.vel,
|
|
|
|
ori: *ecs_data.ori,
|
|
|
|
};
|
|
|
|
|
2020-01-21 22:54:32 +00:00
|
|
|
handle_move_dir(ecs_data, &mut update);
|
|
|
|
handle_wield(ecs_data, &mut update);
|
|
|
|
handle_sit(ecs_data, &mut update);
|
|
|
|
handle_climb(ecs_data, &mut update);
|
|
|
|
handle_roll(ecs_data, &mut update);
|
|
|
|
//handle_jump(ecs_data, &mut update);
|
|
|
|
handle_glide(ecs_data, &mut update);
|
2019-12-28 16:10:39 +00:00
|
|
|
|
2020-01-12 23:14:08 +00:00
|
|
|
update
|
2019-12-28 16:10:39 +00:00
|
|
|
}
|
|
|
|
}
|