Class GameManager
The GameManager class manages the overall game logic, including game modes, player states,
game events, and game-over conditions. It ensures a single instance exists and provides
functionality for starting, updating, and ending the game.
Inheritance
object
GameManager
Assembly: cs.temp.dll.dll
Syntax
public class GameManager : MonoBehaviour
Fields
gameMode
Declaration
public static GameManager.GameMode gameMode
Field Value
gameOver
Declaration
Field Value
gameTimer
Declaration
public GameTimer gameTimer
Field Value
hatObject
Declaration
public GameObject hatObject
Field Value
| Type |
Description |
| GameObject |
|
hatSpawnPositions
Declaration
public List<Vector2> hatSpawnPositions
Field Value
| Type |
Description |
| List<><Vector2> |
|
LeaderboardCanvas
Declaration
public Canvas LeaderboardCanvas
Field Value
map
Declaration
Field Value
music
Declaration
Field Value
obstacleCourseSpawnPosition
Declaration
public Vector2 obstacleCourseSpawnPosition
Field Value
offset
Declaration
Field Value
playerColors
Declaration
public static List<Color> playerColors
Field Value
| Type |
Description |
| List<><Color> |
|
playerHoldTimes
Declaration
public static Dictionary<GameObject, float> playerHoldTimes
Field Value
| Type |
Description |
| Dictionary<, ><GameObject, float> |
|
players
Declaration
public static List<GameObject> players
Field Value
| Type |
Description |
| List<><GameObject> |
|
spawnPosition
Declaration
public Vector2 spawnPosition
Field Value
time
Declaration
Field Value
TimerCanvas
Declaration
public Canvas TimerCanvas
Field Value
Properties
Instance
Declaration
public static GameManager Instance { get; }
Property Value
Methods
AlivePlayers()
Returns a list of all players that are currently alive.
Declaration
public List<GameObject> AlivePlayers()
Returns
| Type |
Description |
| List<><GameObject> |
A list of alive player GameObjects.
|
GameOver()
Ends the game and determines the winner based on the game mode.
Declaration
PlayerDied(Damageable)
Handles player deaths based on the current game mode.
Declaration
public void PlayerDied(Damageable player)
Parameters
| Type |
Name |
Description |
| Damageable |
player |
The player that died.
|
StartGame()
Sets up the game based on the selected game mode.
Declaration
UpdatePlayerHoldTime(GameObject, float)
Updates the player's hold time and updates the leaderboard.
Declaration
public void UpdatePlayerHoldTime(GameObject player, float holdTime)
Parameters
| Type |
Name |
Description |
| GameObject |
player |
The player GameObject.
|
| float |
holdTime |
The hold time to update.
|
Events
EndGameEvent
Declaration
public event GameManager.GameEvent EndGameEvent
Event Type
StartGameEvent
Declaration
public event GameManager.GameEvent StartGameEvent
Event Type