The UVK::GameMode
class is entirely owned by a level and contains pointers to a Game State
, Player State
and a `Player Controller
GM
)gameMode = GameMode::makeGameMode<GM>();
To use the game mode’s events in your level, call the void beginAutohandle()
, void tickAutohandle(float deltaTime)
and void endAutohandle()
in their respective functions void beginPlay()
, void tick(float deltaTime)
, void endPlay()
. This will call all the game mode’s events when one of those events is triggered.
Semantically, the game mode should be used to store the rules of the game and possibly manage them
The game mode class provides a static Pawn* getPawn(GameMode* gameMode)
function to easily access the pawn without navigating down the hierarchy
The game mode owns pointers to a GameState
, PlayerState
and a PlayerController
. The same “autohandle” events apply here to call the events of all these classes.
You can use the standard cast
function to cast a pointer to a game mode to its original type, like this
gameMode = GameMode::makeGameMode<GM>();
auto* a = GameMode::cast<GM>(gameMode);