rust_warrior/engine/
world.rs

1use crate::{floor::Floor, unit::Unit, Player};
2
3/// The mutating game state managed by the engine.
4pub struct World {
5    pub player_name: String,
6    pub warrior_level: usize,
7    pub floor: Floor,
8    pub player: Box<dyn Player + Send + Sync>,
9    pub warrior: Unit,
10    pub other_units: Vec<Unit>,
11}
12
13impl World {
14    pub fn new(
15        player_name: String,
16        warrior_level: usize,
17        floor: Floor,
18        player: Box<dyn Player + Send + Sync>,
19        warrior: Unit,
20        other_units: Vec<Unit>,
21    ) -> World {
22        World {
23            player_name,
24            warrior_level,
25            floor,
26            player,
27            warrior,
28            other_units,
29        }
30    }
31
32    pub fn remove_unit(&mut self, index: usize) {
33        self.other_units.remove(index);
34    }
35}