A plugin with a custom game mode with different states.
The plugin can be used in both C++ and Blueprint projects.
- Download package file;
- Install the plugin either in your project or for all projects in engine:
- Unzip the package into Plugins folder of your project, e.g.
D:\UnrealProjects\MyProject\Plugins
; - Unzip the package to the Plugins folder in engine folder, e.g.
C:\Program Files\Epic Games\UE_5.0\Engine\Plugins
;
- Unzip the package into Plugins folder of your project, e.g.
- Restart the project;
In this case the plugin can be used for any blueprint project.
- Create the Plugins folder in the project directory;
- Create the TrickyAnimationComponents folder in the Plugins folder;
- Download the plugin source code into that folder;
- Rebuild the project;
The plugin has actors:
- TrickyGameModeBase;
- TrickyPlayerControllerBase;
A basic game mode which has different states and timers implemented.
CurrentState
- current state of the game:Inactive
- a default state ifManualStart
== true;Preparation
- the game enters this state ifPreparationTimer
> 0;InProgress
- a state in which gameplay happensPause
- a state during game pauseWin
- a state when the game session finished and the player wonLose
- a state when the game session finished and the player lostTransition
- a state to transition game between levels or menus
ManualStart
- if true the session will start automatically, else StartSession function must be called.PreparationDuration
- defines the time of the preparation state;PreparationTimer
- preparation timer handle;LimitSessionTime
- toggle if session time is limited or not;SessionDuration
- session length if its time is limited;VictoryOnTimeOver
- determines if session finished with victory when time is over;FinalTime
- the final time of the session when it finishes;ShowDebug
- toggles debug information in editor and debug builds;
StartSession
- starts the session;FinishSession
- finishes the session;StartPreparation
- starts a preparation timer;GetSessionElapsedTime
- returns session elapsed time;GetSessionRemainingTime
- returns session remaining time;
HandleSessionChange
- called when the state was changed;
A player controller actor which has pause and GameModeSession states functionality;
bShowCursorOnStart
- toggle if the mouse cursor must be shown when the session started;
PauseGame
- pauses the game;OnGameModeStateChanged
- called when the session state was changed.- Override this function if you want to implement your controller functionality when the state was changed;
- Create blueprint game mode inherited from GameModeSession class;
- Adjust parameters as you want;
- Choose this game mode in project settings;
- Create blueprint player controller inherited from PlayerController class;
- Adjust parameters as you want;
- Choose this player controller in project settings;
- To pause and unpause game call the
PauseGame
function in the controller;