2019-05-22 20:53:24 +00:00
|
|
|
use specs::{Component, FlaggedStorage, VecStorage};
|
|
|
|
use vek::*;
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub enum InputEvent {
|
|
|
|
Jump,
|
|
|
|
Attack,
|
2019-05-24 19:20:28 +00:00
|
|
|
RequestRespawn,
|
2019-05-22 20:53:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct Inputs {
|
|
|
|
// Held down
|
|
|
|
pub move_dir: Vec2<f32>,
|
|
|
|
pub jumping: bool,
|
|
|
|
pub gliding: bool,
|
|
|
|
|
|
|
|
// Event based
|
|
|
|
pub events: Vec<InputEvent>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Component for Inputs {
|
|
|
|
type Storage = VecStorage<Self>;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct Actions {
|
|
|
|
pub attack_time: Option<f32>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Component for Actions {
|
|
|
|
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
|
|
|
|
}
|