The GameState
The GameState is a component that represents the state of the game. It is essentially a dictionary of GameStateProperties.
Multiple GameStates can exist in the game, but only one is used for actual gameplay. Other GameStates might be used for recording and displaying past gamestates.
Important
The keys for each GameStateProperty needs to be standardised by the game designer in order for the game to work properly. Meaning that the key for each GameStateProperty should be same across all GameState components in the game, as well as in the predifined state changes of Proposal Scriptable Objects.
Tip
Because the [HistoryViewer] also has a GameState, it is recommended to save the GameState and GameStateProperties into one prefab to be reused. Editing of the options in GameState and GameStateProperties should then be done and saved on the prefab.
Game State Properties
are properties of the game state that are affected by the main gameplay loop (accepting/rejecting proposals).
Tip
- To write your own GameStateProperty, implement a class that inherits from the GameStateProperty base class
- If a GameStateProperty has effects that should be applied at the end of a level (e.g. funds top up at the end of a level) the child class should also implement the IEndOfLevelHandler interface.
Time Dependent Game States
are properties that are time-sensitive.