Skip to main content

GameTimerUpdateSystem Class

Updates all game timers managed by the TimerManager. More...

Declaration

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

Public Member Typedefs Index

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

Public Constructors Index

GameTimerUpdateSystem (TimerManager &timerManager)

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

Public Member Functions Index

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

Advances all game timers by the current delta time. More...

Private Member Attributes Index

TimerManager &timerManager_

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

Description

Updates all game timers managed by the TimerManager.

Each frame, this system iterates over all registered timers and advances their elapsed time by the current delta time.

See Also

TimerManager

See Also

GameTimer

Definition at line 39 of file GameTimerUpdateSystem.ixx.

Public Member Typedefs

EngineRoleTag

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

Public Constructors

GameTimerUpdateSystem()

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

Constructs the system with a reference to the TimerManager.

Parameters
timerManager

The manager whose timers are updated.

Definition at line 57 of file GameTimerUpdateSystem.ixx.

57 explicit GameTimerUpdateSystem(TimerManager& timerManager)
58 : timerManager_(timerManager) {}

Public Member Functions

update()

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

Advances all game timers by the current delta time.

Parameters
updateContext

The current frame's update context.

Definition at line 65 of file GameTimerUpdateSystem.ixx.

66
67 for (auto& gameTimer : timerManager_.gameTimers()) {
68 if (gameTimer.state() == TimerState::Running) {
69
70 gameTimer.update(updateContext.deltaTime());
71
72 if (gameTimer.duration() != 0.0f && gameTimer.elapsed() >= gameTimer.duration()) {
73 auto context = TimerControlContext{gameTimer.gameTimerId(), TimerState::Finished};
74 updateContext.queueCommand<TimerControlCommand>(context);
75 }
76 }
77 }
78 }

References helios::engine::mechanics::timing::types::Finished and helios::engine::mechanics::timing::types::Running.

Private Member Attributes

timerManager_

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

Reference to the TimerManager owning the timers.

Definition at line 44 of file GameTimerUpdateSystem.ixx.

44 TimerManager& timerManager_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.