Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

[U] Game mode

Stanislav Vasilev edited this page Aug 25, 2021 · 9 revisions

The UVK::GameMode class is entirely owned by a level and contains pointers to a Game State, Player State, Pawn and a `Player Controller

Creation

  1. Generate a game mode using the Build Tool (for this example it's going to be called GM)
  2. Include the game mode header into your level's header
  3. In the constructor call add the following line with the type of your game mode class as a template argument
gameMode = GameMode::makeGameMode<GM>();
  1. You have a game mode for your level

Usage

To use the game mode's events in you 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 of the game mode's events when one of those events is triggered

Classes

Casting

You can use the standard cast function to cast a pointer to a game mode to it's original type like this

gameMode = GameMode::makeGameMode<GM>();
auto* a = GameMode::cast<GM>(gameMode);
Clone this wiki locally