Search Results for

    Show / Hide Table of Contents

    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
    Namespace: Game
    Assembly: cs.temp.dll.dll
    Syntax
    public class GameManager : MonoBehaviour

    Fields

    gameMode

    Declaration
    public static GameManager.GameMode gameMode
    Field Value
    Type Description
    GameManager.GameMode

    gameOver

    Declaration
    public bool gameOver
    Field Value
    Type Description
    bool

    gameTimer

    Declaration
    public GameTimer gameTimer
    Field Value
    Type Description
    GameTimer

    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
    Type Description
    Canvas

    map

    Declaration
    public static string map
    Field Value
    Type Description
    string

    music

    Declaration
    public static bool music
    Field Value
    Type Description
    bool

    obstacleCourseSpawnPosition

    Declaration
    public Vector2 obstacleCourseSpawnPosition
    Field Value
    Type Description
    Vector2

    offset

    Declaration
    public float offset
    Field Value
    Type Description
    float

    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
    Type Description
    Vector2

    time

    Declaration
    public float time
    Field Value
    Type Description
    float

    TimerCanvas

    Declaration
    public Canvas TimerCanvas
    Field Value
    Type Description
    Canvas

    Properties

    Instance

    Declaration
    public static GameManager Instance { get; }
    Property Value
    Type Description
    GameManager

    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
    public void GameOver()

    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
    public void StartGame()

    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
    Type Description
    GameManager.GameEvent

    StartGameEvent

    Declaration
    public event GameManager.GameEvent StartGameEvent
    Event Type
    Type Description
    GameManager.GameEvent
    In This Article
    Back to top Example Unity documentation footer