AGameState

Inheritance Hierarchy

Syntax

class AGameState : public AGameStateBase

Remarks

GameState is a subclass of GameStateBase that behaves like a multiplayer match-based game. It is tied to functionality in GameMode.

Variables

Name Description

Public variable

int32

 

ElapsedTime

Elapsed game time since match has started.

Protected variable

FName

 

MatchState

What match state we are currently in

Protected variable

FName

 

PreviousMatchState

Previous map state, used to handle if multiple transitions happen per frame

Protected variable

FTimerHandle

 

TimerHandle_DefaultTimer

Handle for efficient management of DefaultTimer timer

Functions

Name Description

Public function Virtual

void

 

DefaultTimer()

Called periodically, overridden by subclasses

Protected function Virtual

void

 

HandleLeavingMap()

Called when the match transitions to LeavingMap

Protected function Virtual

void

 

HandleMatchHasEnded()

Called when the map transitions to WaitingPostMatch

Protected function Virtual

void

 

HandleMatchHasStarted()

Called when the state transitions to InProgress

Protected function Virtual

void

 

HandleMatchIsWaitingToStart()

Called when the state transitions to WaitingToStart

Public function Virtual

void

 

OnRep_ElapsedTime()

Gives clients the chance to do something when time gets updates

Public function Virtual

void

 

OnRep_MatchState()

Match state has changed

Public function Virtual

bool

 

ShouldShowGore()

Overridden from AGameStateBase

Name Description

Public function Virtual

float

 

GetPlayerRespawnDelay

(
    AController* Controller
)

Returns how much time needs to be spent before a player can respawn

Public function Virtual

float

 

GetPlayerStartTime

(
    AController* Controller
)

Returns the time that should be used as when a player started

Public function Virtual

void

 

HandleBeginPlay()

Called by game mode to set the started play bool

Public function Virtual

bool

 

HasMatchStarted()

Returns true if the world has started match (called MatchStarted callbacks)

Overridden from AActor

Name Description

Public function Virtual

void

 

PostInitializeComponents()

Allow actors to initialize themselves on the C++ side.

References

Module

Engine

Header

Runtime/Engine/Classes/GameFramework/GameState.h