diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-05-12 15:10:35 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-05-12 15:10:35 +0200 |
commit | 2d6ee1dddda6a51692adff10160bb93a76430b0b (patch) | |
tree | a511c252097e15cb3b6f9ebbd675e14f1e3665a8 /src/engine/settings.rs | |
parent | 4755702ef08d70961b5248cb706a592a406d0556 (diff) |
Added new building specifications
Diffstat (limited to 'src/engine/settings.rs')
-rw-r--r-- | src/engine/settings.rs | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/engine/settings.rs b/src/engine/settings.rs index a6691d7..b23d6bd 100644 --- a/src/engine/settings.rs +++ b/src/engine/settings.rs @@ -1,10 +1,33 @@ use super::geometry::Point; +use super::command::BuildingType; #[derive(Debug)] pub struct GameSettings { pub size: Point, pub energy_income: u16, - pub energy_price: u16, - pub defence_price: u16, - pub attack_price: u16 + pub energy: BuildingSettings, + pub defence: BuildingSettings, + pub attack: BuildingSettings +} + +#[derive(Debug)] +pub struct BuildingSettings { + pub price: u16, + pub health: u16, + pub construction_time: u8, + pub weapon_damage: u16, + pub weapon_speed: u8, + pub weapon_cooldown_period: u8, + pub energy_generated_per_turn: u16 +} + +impl GameSettings { + pub fn building_settings(&self, building: BuildingType) -> &BuildingSettings { + match building { + BuildingType::Defence => &self.defence, + BuildingType::Attack => &self.attack, + BuildingType::Energy => &self.energy + } + } + } |