Skip to content

GameController

Damian Ochramowicz edited this page Apr 24, 2017 · 2 revisions

GameController

Namespace: Assets.Scripts.Modules

Description:

GameController class controls game's runtime. It's responsible for saving and loading game, changing actual level etc.

Public methods:

Start

Type: void
Params: none
Description: Start method is responsible for setting up object.

RestartRoom

Type: static void
Params: None
Description: Reloads current room

SaveGame

Type: void
Params: string saveName
Description: saves current game state, and gives it saveName identifier for further load.

LoadGame

Type: void
Params: string saveName
Description: loads state of game saved with saveName identifier.
Throws: UnityException - when saved game does not exists

SetGamePaused

Type: void
Params: None Description: Changes game state to paused.

SetGameRunning

Type: void
Params: None Description: Changes game state to running.

GameOver

Type: void
Params: None Description: Ends the game.

SetItemFlag

Type: static void
Params: string key
Description: Sets collected flag for item to true.

Private methods:

GameFinished

Type: void
Params: None
Description: Ends the game, when player reaches endgoal.

GetGameData

Type: SaveDataDto
Params: None
Description: Returns current transfer object with data about current play session. Used for saving.

SetGameData

Type: void
Params: SaveDataDto dto, string saveName
Description: Sets data from DTO. saveName parameter is used to continue loading, when change of room is necessary.

Update

Type: void
Params: None
Description: Main loop proceeded in every game frame.