Interface IGameModeService
Service interface for managing game mode state and transitions.
Namespace: Serenity.GameMode.Application.Interfaces
Assembly: Serenity.GameMode.Application.dll
Syntax
public interface IGameModeService : IService, IFoundationSettings
Remarks
Implementations handle transitions between Menu, Game, and Pause modes, coordinating input routing, time scale, and UI changes.
Properties
CurrentMode
Gets the current game mode.
Declaration
GameMode CurrentMode { get; }
Property Value
| Type | Description |
|---|---|
| GameMode |
IsPaused
Gets whether the game is currently in a paused state.
Declaration
bool IsPaused { get; }
Property Value
| Type | Description |
|---|---|
| bool |
PreviousMode
Gets the previous game mode before the last transition.
Declaration
GameMode PreviousMode { get; }
Property Value
| Type | Description |
|---|---|
| GameMode |
Methods
EnterGame()
Enters Game mode from Menu mode.
Declaration
void EnterGame()
Remarks
Convenience method equivalent to SetMode(GameMode.Game).
EnterMenu()
Enters Menu mode.
Declaration
void EnterMenu()
Remarks
Convenience method equivalent to SetMode(GameMode.Menu).
SetMode(GameMode)
Sets the game mode to the specified mode.
Declaration
void SetMode(GameMode mode)
Parameters
| Type | Name | Description |
|---|---|---|
| GameMode | mode | The target game mode. |
TogglePause()
Toggles between Game and Pause modes.
Declaration
void TogglePause()
Remarks
Has no effect when in Menu mode. When in Game mode, transitions to Pause. When in Pause mode, transitions back to Game.