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

Constructors

Name Description

Public function

AGameState

(
    const FObjectInitializer & ObjectIn...
)

============================================================================= GameState.cpp: GameState C++ code.

Functions

Name Description

Public function Virtual

void

 

DefaultTimer()

Called periodically, overridden by subclasses

Public function

FName

 

GetMatchState()

Code to deal with the match state machine.

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

bool

 

HasMatchEnded()

Returns true if match is WaitingPostMatch or later

Public function Virtual

bool

 

IsMatchInProgress()

Returns true if we're in progress

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

void

 

SetMatchState

(
    FName NewState
)

Updates the match state and calls the appropriate transition functions, only valid on server

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)

Public function Virtual

void

 

ReceivedGameModeClass()

Interaction with GameModeBase.

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