rustorio_engine/gamemodes.rs
1//! A game mode defines the starting resources and victory conditions for a game.
2
3use crate::tick::Tick;
4
5/// The starting resources of a game mode. These are provided to the player at the beginning of the game.
6pub trait StartingResources {
7 /// Called once at the start of the game before control is handed to the player to create the starting resources.
8 ///
9 /// # Parameters
10 /// - `tick`: The current game tick. Since this method is called at the start of the game, this will always be tick 0.
11 fn init(tick: &Tick) -> Self;
12}
13
14/// A game mode defines the starting resources and victory conditions for a game.
15pub trait GameMode {
16 /// Starting resources provided to the player at the beginning of the game.
17 #[allow(private_bounds)]
18 type StartingResources: StartingResources;
19 /// Resources required to achieve victory.
20 type VictoryResources;
21}