summaryrefslogtreecommitdiff
path: root/src/state.rs
blob: 2f81d5d92f70f0ab055b3302aba7a5f454516c9a (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
34
35
36
37
use crate::command::Command;

pub struct GameState {
    players: [Player; 2],
}

pub struct Player {}
impl GameState {
    fn update(&mut self, commands: [Command; 2]) {
        self.do_command(0, &commands[0]);
        self.do_command(1, &commands[1]);
        self.update_player_collisions();
        self.update_player_travel();
    }

    fn do_command(&mut self, player_index: usize, command: &Command) {
        use Command::*;

        match command {
            Nothing => {}
            Accelerate => unimplemented!(),
            Decelerate => unimplemented!(),
            TurnLeft => unimplemented!(),
            TurnRight => unimplemented!(),
            UseBoost => unimplemented!(),
            UseOil => unimplemented!(),
        }
    }

    fn update_player_collisions(&mut self) {
        //TODO
    }

    fn update_player_travel(&mut self) {
        //TODO
    }
}