Central game object from which the players and other properties can be accessed. More...
Public Types | |
enum | GameState { Preview, Countdown, Race, Finish } |
Current state of the game. More... | |
Public Member Functions | |
void | Awake () |
Validates the game state at startup. | |
void | Update () |
Called each frame to sort racers. | |
void | OnApplicationQuit () |
Called on exit. | |
void | RegisterPlayer (Competitor competitor) |
Registers a player competitor. | |
void | Restart () |
Resets the game. | |
void | ExitToMenu () |
Exits to the main menu. | |
bool | IsOutOfBounds (float x, float y) |
Returns true if the specified location is outside the track boundary. | |
void | FadeCamera (int index, float opacity) |
Fades the specified player camera. | |
void | OnPauseChanged () |
Pause state property change. | |
void | OnGameStateChanged (GameState oldState) |
Game state property change. | |
Public Attributes | |
Checkpoint | startFinishCheckpoint |
The first (and last) checkpoint. | |
GameObject | playerCameraPrefab |
The prefab used to load player chasing cameras. | |
Camera | levelCamera |
The main level preview camera. | |
Rect | mapBounds |
The bounds that correspond to both the map image and the out of bounds mask image. | |
Texture2D | mapMask |
Greyscale texture mask: white for track, black for out of bounds, grey for areas that should give out-of-bounds if in for too long. | |
AudioSource | music |
Main game music. | |
Competitor[] | players = new Competitor[0] |
Players. | |
RaceStatistics[] | statistics = new RaceStatistics[0] |
Statistics. | |
CameraController[] | cameras = new CameraController[0] |
Player cameras. | |
float[] | cameraOpacities = new float[0] |
Player camera opacities for fading. | |
Properties | |
static readonly MainGame | instance [get] |
The single instance. | |
GameState | gameState [get, set] |
The current state of the game. | |
bool | paused [get, set] |
Whether the game is paused. |
Central game object from which the players and other properties can be accessed.
enum MainGame::GameState |
Current state of the game.
void MainGame.Awake | ( | ) |
Validates the game state at startup.
void MainGame.ExitToMenu | ( | ) |
Exits to the main menu.
void MainGame.FadeCamera | ( | int | index, | |
float | opacity | |||
) |
Fades the specified player camera.
bool MainGame.IsOutOfBounds | ( | float | x, | |
float | y | |||
) |
Returns true if the specified location is outside the track boundary.
void MainGame.OnApplicationQuit | ( | ) |
Called on exit.
void MainGame.OnGameStateChanged | ( | GameState | oldState | ) |
Game state property change.
void MainGame.OnPauseChanged | ( | ) |
Pause state property change.
void MainGame.RegisterPlayer | ( | Competitor | competitor | ) |
Registers a player competitor.
void MainGame.Restart | ( | ) |
Resets the game.
void MainGame.Update | ( | ) |
Called each frame to sort racers.
float [] MainGame.cameraOpacities = new float[0] |
Player camera opacities for fading.
CameraController [] MainGame.cameras = new CameraController[0] |
Player cameras.
Camera MainGame.levelCamera |
The main level preview camera.
Rect MainGame.mapBounds |
The bounds that correspond to both the map image and the out of bounds mask image.
Texture2D MainGame.mapMask |
Greyscale texture mask: white for track, black for out of bounds, grey for areas that should give out-of-bounds if in for too long.
AudioSource MainGame.music |
Main game music.
GameObject MainGame.playerCameraPrefab |
The prefab used to load player chasing cameras.
Competitor [] MainGame.players = new Competitor[0] |
Players.
The first (and last) checkpoint.
RaceStatistics [] MainGame.statistics = new RaceStatistics[0] |
Statistics.
GameState MainGame.gameState [get, set] |
The current state of the game.
readonly MainGame MainGame.instance [static, get] |
The single instance.
bool MainGame.paused [get, set] |
Whether the game is paused.