Skip to main content

GameTimerClearSystem Class

Resets finished game timers to an undefined state. More...

Declaration

class helios::engine::mechanics::timing::systems::GameTimerClearSystem { ... }

Public Member Typedefs Index

usingEngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors Index

GameTimerClearSystem (TimerManager &timerManager)

Constructs the system with a reference to the TimerManager. More...

Public Member Functions Index

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

Resets all finished timers to TimerState::Undefined. More...

Private Member Attributes Index

TimerManager &timerManager_

Reference to the TimerManager owning the timers. More...

Description

Resets finished game timers to an undefined state.

Each frame, this system iterates over all registered timers and resets any timer whose state is `TimerState::Finished` back to `TimerState::Undefined`. This ensures that one-shot timer completions are consumed within a single frame and do not trigger downstream logic more than once.

See Also

TimerManager

See Also

GameTimer

Definition at line 37 of file GameTimerClearSystem.ixx.

Public Member Typedefs

EngineRoleTag

using helios::engine::mechanics::timing::systems::GameTimerClearSystem::EngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors

GameTimerClearSystem()

helios::engine::mechanics::timing::systems::GameTimerClearSystem::GameTimerClearSystem (TimerManager & timerManager)
inline explicit

Constructs the system with a reference to the TimerManager.

Parameters
timerManager

The manager whose timers are cleared.

Definition at line 54 of file GameTimerClearSystem.ixx.

54 explicit GameTimerClearSystem(TimerManager& timerManager)
55 : timerManager_(timerManager) {}

Public Member Functions

update()

void helios::engine::mechanics::timing::systems::GameTimerClearSystem::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept

Resets all finished timers to TimerState::Undefined.

Parameters
updateContext

The current frame's update context.

Definition at line 62 of file GameTimerClearSystem.ixx.

63
64 for (auto& gameTimer : timerManager_.gameTimers()) {
65 if (gameTimer.state() == TimerState::Finished || gameTimer.state() == TimerState::Cancelled) {
66 gameTimer.setState(TimerState::Undefined);
67 }
68 }
69 }

References helios::engine::mechanics::timing::types::Cancelled, helios::engine::mechanics::timing::types::Finished and helios::engine::mechanics::timing::types::Undefined.

Private Member Attributes

timerManager_

TimerManager& helios::engine::mechanics::timing::systems::GameTimerClearSystem::timerManager_

Reference to the TimerManager owning the timers.

Definition at line 42 of file GameTimerClearSystem.ixx.

42 TimerManager& timerManager_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.