Skip to main content

MatchFlowSystem Class

Automatically advances the match through its state phases. More...

Declaration

class helios::engine::mechanics::match::systems::MatchFlowSystem { ... }

Base class

classSystem

Abstract base class for game systems. More...

Public Member Functions Index

voidupdate (helios::engine::runtime::world::UpdateContext &updateContext) noexcept override

Processes match state and issues transition commands. More...

Private Member Attributes Index

MatchStateprevMatchState_ = MatchState::Undefined
StateTransitionIdType< MatchState >prevMatchStateTransitionId_ = StateTransitionIdType<MatchState>::Undefined

Description

Automatically advances the match through its state phases.

This system checks the current match state and issues appropriate transition commands to progress through: Undefined -> Warmup -> PlayerSpawn -> Playing.

Definition at line 38 of file MatchFlowSystem.ixx.

Public Member Functions

update()

void helios::engine::mechanics::match::systems::MatchFlowSystem::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept virtual

Processes match state and issues transition commands.

Parameters
updateContext

The current update context.

Definition at line 51 of file MatchFlowSystem.ixx.

51 void update(helios::engine::runtime::world::UpdateContext& updateContext) noexcept override {
52
53 auto& session = updateContext.session();
54
55
56 auto& commandBuffer = updateContext.commandBuffer();
57 const auto matchState = session.state<MatchState>();
58 auto matchStateTransitionId = session.stateTransitionId<MatchState>();
59
60 if (matchState != MatchState::Undefined && prevMatchState_ == matchState && prevMatchStateTransitionId_ == matchStateTransitionId) {
61 return;
62 }
63
64 prevMatchState_= matchState;
65 prevMatchStateTransitionId_ = matchStateTransitionId;
66
67 switch (matchState) {
68
70 commandBuffer.add<StateCommand<MatchState>>(
72 );
73 break;
74 }
75
77 commandBuffer.add<StateCommand<MatchState>>(
79 );
80 break;
81 }
82
84 commandBuffer.add<StateCommand<MatchState>>(
86 );
87 break;
88 }
89
91 commandBuffer.add<StateCommand<MatchState>>(
93 );
94 break;
95 }
96
98 if (matchStateTransitionId == MatchStateTransitionId::QuitRequested) {
99 commandBuffer.add<StateCommand<MatchState>>(
101 );
102 }
103
104 break;
105 }
106
107
108 default:
109 break;
110 }
111 }

References helios::engine::mechanics::match::types::Finished, helios::engine::mechanics::match::types::PlayerDeath, helios::engine::mechanics::match::types::PlayerSpawn, helios::engine::mechanics::match::types::PlayerSpawnRequested, helios::engine::mechanics::match::types::QuitRequested, helios::engine::mechanics::match::types::StartRequested, helios::engine::mechanics::match::types::Undefined, helios::engine::mechanics::match::types::Warmup and helios::engine::mechanics::match::types::WarmupRequested.

Private Member Attributes

prevMatchState_

MatchState helios::engine::mechanics::match::systems::MatchFlowSystem::prevMatchState_ = MatchState::Undefined

Definition at line 40 of file MatchFlowSystem.ixx.

40 MatchState prevMatchState_ = MatchState::Undefined;

prevMatchStateTransitionId_

StateTransitionIdType<MatchState> helios::engine::mechanics::match::systems::MatchFlowSystem::prevMatchStateTransitionId_ = StateTransitionIdType<MatchState>::Undefined

Definition at line 41 of file MatchFlowSystem.ixx.


The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.