Class GameState
Represents global game state.
Namespace: Backend
Assembly: cs.temp.dll.dll
Syntax
public static class GameState
Fields
s_Households
A list of all households in the game. We originally wanted to have AI players which is why this is here, but we didn't end up doing that.
Declaration
public static Household[] s_Households
Field Value
Type | Description |
---|---|
Household[] |
s_Phase
Game phase/season. From 1 to 3.
Declaration
public static int s_Phase
Field Value
Type | Description |
---|---|
int |
s_Player
The player's household object.
Declaration
public static Household s_Player
Field Value
Type | Description |
---|---|
Household |
s_PredefinedHouseholds
Array of predefined households that the player can choose from. Learn from our mistakes and don't do this in your own projects, load data from a JSON file or something instead.
Declaration
public static Household[] s_PredefinedHouseholds
Field Value
Type | Description |
---|---|
Household[] |
s_WeatherIndex
Game weather index. From 1 (best) to 5 (worst).
Declaration
public static int s_WeatherIndex
Field Value
Type | Description |
---|---|
int |
s_Year
Game year.
Declaration
public static int s_Year
Field Value
Type | Description |
---|---|
int |
StartMoney
Starting money of player.
Declaration
public const int StartMoney = 500
Field Value
Type | Description |
---|---|
int |
Methods
AdvanceToPhaseOne()
Advance to phase 1, the growing season. (Year 2+ only) Choose random village event and household event for each household, but there might not be one. Handle starvation and losing condition if player wheat is in the negatives. Automatically loads phase 2 if you don't have any tubewells.
Declaration
public static void AdvanceToPhaseOne()
AdvanceToPhaseThree()
Advance to phase 3, the planting season. Any hired labour is removed.
Declaration
public static void AdvanceToPhaseThree()
AdvanceToPhaseTwo()
Advance to phase 2, the harvest season. Simply sets the phase variable and switches scenes.
Declaration
public static void AdvanceToPhaseTwo()
Initialize(Household)
Initializes the game, setting year and phase to 0 (this happens before the main gameplay).
Declaration
public static void Initialize(Household Player)
Parameters
Type | Name | Description |
---|---|---|
Household | Player | The household that the player chose. |
ResultReport()
Helper method to return game data to be displayed in the results screen at the end.
Declaration
public static Dictionary<string, int> ResultReport()
Returns
Type | Description |
---|---|
Dictionary<string, int> | Game data used for results. |