2020-03-07 18:15:02 +00:00
|
|
|
use specs::{Component, DenseVecStorage, FlaggedStorage, HashMapStorage};
|
2020-01-01 17:16:29 +00:00
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
|
2020-03-07 18:15:02 +00:00
|
|
|
pub enum AbilityState {
|
|
|
|
BasicAttack,
|
|
|
|
BasicBlock,
|
|
|
|
Roll,
|
2020-01-01 17:16:29 +00:00
|
|
|
}
|
2020-03-07 18:15:02 +00:00
|
|
|
impl Default for AbilityState {
|
|
|
|
fn default() -> Self { Self::BasicAttack }
|
2020-01-01 17:16:29 +00:00
|
|
|
}
|
|
|
|
|
2020-03-07 18:15:02 +00:00
|
|
|
impl Component for AbilityState {
|
|
|
|
type Storage = DenseVecStorage<Self>;
|
2020-01-01 17:16:29 +00:00
|
|
|
}
|
|
|
|
|
2020-02-03 10:54:50 +00:00
|
|
|
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
|
2020-01-01 17:16:29 +00:00
|
|
|
pub struct AbilityPool {
|
2020-03-07 18:15:02 +00:00
|
|
|
pub primary: Option<AbilityState>,
|
|
|
|
pub secondary: Option<AbilityState>,
|
|
|
|
pub block: Option<AbilityState>,
|
|
|
|
pub dodge: Option<AbilityState>,
|
2020-01-01 17:16:29 +00:00
|
|
|
}
|
|
|
|
|
2020-02-03 10:54:50 +00:00
|
|
|
impl Default for AbilityPool {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
2020-03-07 18:15:02 +00:00
|
|
|
primary: Some(AbilityState::BasicAttack),
|
2020-03-07 19:55:15 +00:00
|
|
|
secondary: Some(AbilityState::BasicBlock),
|
2020-02-03 10:54:50 +00:00
|
|
|
block: None,
|
2020-03-07 18:15:02 +00:00
|
|
|
dodge: Some(AbilityState::Roll),
|
2020-02-03 10:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-01 17:16:29 +00:00
|
|
|
impl Component for AbilityPool {
|
2020-01-07 15:49:08 +00:00
|
|
|
type Storage = FlaggedStorage<Self, HashMapStorage<Self>>;
|
2020-01-01 17:16:29 +00:00
|
|
|
}
|