Split to library. Reimplemented sample strategy in new state.
[entelect-challenge-tower-defence.git] / src / engine / command.rs
1 use std::fmt;
2 use super::geometry::Point;
3
4 #[derive(Debug, Clone, Copy)]
5 pub enum Command {
6     Nothing,
7     Build(Point, BuildingType),
8 }
9
10 impl fmt::Display for Command {
11     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12         match self {
13             &Command::Nothing => write!(f, ""),
14             &Command::Build(p, b) => write!(f, "{},{},{}", p.x, p.y, b as u8),
15         }
16     }
17 }
18
19 #[repr(u8)]
20 #[derive(Debug, Clone, Copy)]
21 pub enum BuildingType {
22     Defense = 0,
23     Attack = 1,
24     Energy = 2,
25 }