2019-05-25 21:13:38 +00:00
|
|
|
use specs::{Component, FlaggedStorage, NullStorage, VecStorage};
|
2019-05-22 20:53:24 +00:00
|
|
|
use vek::*;
|
|
|
|
|
2019-05-25 21:13:38 +00:00
|
|
|
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
|
|
|
pub struct Respawning;
|
2019-05-22 20:53:24 +00:00
|
|
|
|
2019-06-09 19:33:20 +00:00
|
|
|
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct MoveDir(pub Vec2<f32>);
|
|
|
|
|
2019-05-25 21:13:38 +00:00
|
|
|
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct Attacking {
|
|
|
|
pub time: f32,
|
|
|
|
pub applied: bool,
|
2019-05-22 20:53:24 +00:00
|
|
|
}
|
2019-06-09 14:20:20 +00:00
|
|
|
|
2019-06-09 19:33:20 +00:00
|
|
|
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct OnGround;
|
|
|
|
|
2019-05-25 21:13:38 +00:00
|
|
|
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct Jumping;
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct Gliding;
|
2019-05-22 20:53:24 +00:00
|
|
|
|
2019-05-25 21:13:38 +00:00
|
|
|
impl Component for Respawning {
|
|
|
|
type Storage = NullStorage<Self>;
|
2019-05-22 20:53:24 +00:00
|
|
|
}
|
|
|
|
|
2019-05-25 21:13:38 +00:00
|
|
|
impl Attacking {
|
|
|
|
pub fn start() -> Self {
|
|
|
|
Self {
|
|
|
|
time: 0.0,
|
|
|
|
applied: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-09 14:20:20 +00:00
|
|
|
|
2019-06-09 19:33:20 +00:00
|
|
|
impl Component for MoveDir {
|
|
|
|
type Storage = VecStorage<Self>;
|
|
|
|
}
|
|
|
|
|
2019-05-25 21:13:38 +00:00
|
|
|
impl Component for Attacking {
|
2019-05-22 20:53:24 +00:00
|
|
|
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
|
|
|
|
}
|
2019-05-25 21:13:38 +00:00
|
|
|
|
2019-06-09 19:33:20 +00:00
|
|
|
impl Component for OnGround {
|
|
|
|
type Storage = NullStorage<Self>;
|
|
|
|
}
|
|
|
|
|
2019-05-25 21:13:38 +00:00
|
|
|
impl Component for Jumping {
|
|
|
|
type Storage = NullStorage<Self>;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Component for Gliding {
|
|
|
|
type Storage = NullStorage<Self>;
|
|
|
|
}
|