Skip to main content

DefaultMatchStateTransitionGuards Class

Provides default guard functions for match state transitions. More...

Declaration

class helios::engine::mechanics::match::rules::guards::DefaultMatchStateTransitionGuards { ... }

Public Static Functions Index

static boolisPlayerActive (helios::engine::runtime::world::UpdateContext &updateContext, const StateTransitionRequest< MatchState > transitionRequest)

Guard that allows transition only if the player is active. More...

static boolisPlayerInactive (helios::engine::runtime::world::UpdateContext &updateContext, const StateTransitionRequest< MatchState > transitionRequest)

Guard that allows transition only if the player is inactive. More...

Description

Provides default guard functions for match state transitions.

Guard functions are predicates that determine whether a state transition is allowed. They are evaluated before a transition occurs and can block it by returning false.

All guards are static functions that take an UpdateContext and a MatchStateTransitionRequest, returning true if the transition is allowed.

See Also

MatchStateTransitionRequest

See Also

MatchStateManager

Definition at line 36 of file DefaultMatchStateTransitionGuards.ixx.

Public Static Functions

isPlayerActive()

bool helios::engine::mechanics::match::rules::guards::DefaultMatchStateTransitionGuards::isPlayerActive (helios::engine::runtime::world::UpdateContext & updateContext, const StateTransitionRequest< MatchState > transitionRequest)
inline static

Guard that allows transition only if the player is active.

Parameters
updateContext

The current frame's update context.

transitionRequest

The requested state transition.

Returns

True if the player entity exists and is active.

Definition at line 48 of file DefaultMatchStateTransitionGuards.ixx.

48 static bool isPlayerActive(
50 const StateTransitionRequest<MatchState> transitionRequest
51 ) {
52 auto playerOpt = updateContext.find(updateContext.session().playerEntityHandle());
53 return playerOpt.has_value() && playerOpt->isActive();
54
55 }

References helios::engine::runtime::world::UpdateContext::find, helios::engine::runtime::world::Session::playerEntityHandle and helios::engine::runtime::world::UpdateContext::session.

isPlayerInactive()

bool helios::engine::mechanics::match::rules::guards::DefaultMatchStateTransitionGuards::isPlayerInactive (helios::engine::runtime::world::UpdateContext & updateContext, const StateTransitionRequest< MatchState > transitionRequest)
inline static

Guard that allows transition only if the player is inactive.

Parameters
updateContext

The current frame's update context.

transitionRequest

The requested state transition.

Returns

True if the player entity exists and is inactive.

Definition at line 65 of file DefaultMatchStateTransitionGuards.ixx.

65 static bool isPlayerInactive(
67 const StateTransitionRequest<MatchState> transitionRequest
68 ) {
69 auto playerOpt = updateContext.find(updateContext.session().playerEntityHandle());
70 return playerOpt.has_value() && !playerOpt->isActive();
71
72 }

References helios::engine::runtime::world::UpdateContext::find, helios::engine::runtime::world::Session::playerEntityHandle and helios::engine::runtime::world::UpdateContext::session.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.