Skip to main content

Class GameMode

GameMode is responsible for managing the game state within a specific scene. It acts as a bridge between scene-local systems and the global GameInstance. When a valid GameInstance is present, GameMode facilitates level transitions, session management, and communication with external systems like the server. If no GameInstance is available, GameMode remains inactive and essentially acts as a placeholder to avoid errors or n

[DisallowMultipleComponent]
public sealed class GameMode : MonoBehaviour, IUnityGameService

Inheritance​

Implements​

IUnityGameService

Properties​

IsLoading​

Returns whether the game is currently loading a map.

public bool IsLoading { get; }

Property Value​

bool

Methods​

EndSession()​

Tell Game Intsance to ends the current scene/level and save collected data by invoking the "Next Level" action.

public void EndSession()

RestartLevel()​

Tell Game Intsance to restarts the current level and saved collected data by invoking the "Reload Current Level" action.

public void RestartLevel()

RetrieveCurrentSessionInfo()​

Retrieves the current session information from the GameInstance.

public SessionInfo RetrieveCurrentSessionInfo()

Returns​

SessionInfo

SubscribleDataSend(Action<Action>)​

Subscribes an event delegate to be invoked when data is sent to the server.

public void SubscribleDataSend(Action<Action> ev)

Parameters​

NameTypeDescription
evAction<Action>

UnsubscribleDataSend(Action<Action>)​

Unsubscribes an event delegate from the data send event.

public void UnsubscribleDataSend(Action<Action> ev)

Parameters​

NameTypeDescription
evAction<Action>
  • Properties
    • IsLoading
  • Methods
    • EndSession()
    • RestartLevel()
    • RetrieveCurrentSessionInfo()
    • SubscribleDataSend(Action<Action>)
    • UnsubscribleDataSend(Action<Action>)