blob: 40256d9d52f4dc0efb3c062b3678982972a99c30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
use super::geometry::Point;
use super::command::BuildingType;
#[derive(Debug)]
pub struct GameSettings {
pub size: Point,
pub energy_income: u16,
pub energy: BuildingSettings,
pub defence: BuildingSettings,
pub attack: BuildingSettings
}
#[derive(Debug)]
pub struct BuildingSettings {
pub price: u16,
pub health: u8,
pub construction_time: u8,
pub weapon_damage: u8,
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
}
}
}
|