HealthManager Class
Manager that processes damage commands and updates entity health. More...
Declaration
Public Member Typedefs Index
| using | EngineRoleTag = helios::engine::common::tags::ManagerRole |
Public Member Functions Index
| void | flush (UpdateContext &updateContext) noexcept |
|
Applies all queued damage and emits health events. More... | |
| bool | submit (const ApplyDamageCommand applyDamageCommand) noexcept |
|
Enqueues a damage command for deferred processing. More... | |
| void | init (GameWorld &gameWorld) |
|
Registers this manager as the damage command handler. More... | |
| void | reset () |
|
Clears all pending damage contexts. More... | |
Private Member Attributes Index
| std::vector< DamageContext > | damageContexts_ |
Private Static Attributes Index
| static const helios::util::log::Logger & | logger_ = ... |
|
Logger scoped to HealthManager. More... | |
Description
Manager that processes damage commands and updates entity health.
HealthManager implements the Manager interface for integration into the game loop flush cycle, and provides a registered submit function for ApplyDamageCommand so that incoming damage is queued and applied in batch.
During flush(), each queued DamageContext is resolved: the target's HealthComponent is damaged, a HealthChangedEvent is emitted, and if health reaches zero a HealthDepletedEvent is pushed together with an optional DeadTagComponent.
Event phases:
- HealthChangedEvent is pushed to the **phase** bus (available to systems in the next phase).
- HealthDepletedEvent is pushed to the **pass** bus (available to systems after commit within the same pass).
- See Also
- See Also
- See Also
- See Also
Definition at line 64 of file HealthManager.ixx.
Public Member Typedefs
EngineRoleTag
|
Definition at line 78 of file HealthManager.ixx.
Public Member Functions
flush()
| inline noexcept |
Applies all queued damage and emits health events.
For each pending DamageContext the target's HealthComponent is looked up and damaged. A HealthChangedEvent is pushed per hit. When health transitions from alive to dead, the configured HealthDepletedBehavior flags are evaluated and a HealthDepletedEvent is emitted.
HealthChangedEvent is pushed to the phase bus (available next phase); HealthDepletedEvent is pushed to the pass bus (available after commit within the same pass).
- Parameters
-
updateContext The current frame's update context.
Definition at line 95 of file HealthManager.ixx.
References helios::engine::mechanics::health::types::DeadTag, helios::engine::mechanics::health::types::hasHealthDepletedFlag and helios::engine::mechanics::health::components::HealthComponent::isAlive.
init()
| inline |
Registers this manager as the damage command handler.
- Parameters
-
gameWorld The game world to register with.
Definition at line 157 of file HealthManager.ixx.
reset()
| inline |
Clears all pending damage contexts.
Definition at line 164 of file HealthManager.ixx.
submit()
| inline noexcept |
Enqueues a damage command for deferred processing.
- Parameters
-
applyDamageCommand The damage command to enqueue.
- Returns
True if the command was accepted.
Definition at line 145 of file HealthManager.ixx.
Private Member Attributes
damageContexts_
|
Pending damage contexts collected via submit().
Definition at line 75 of file HealthManager.ixx.
Private Static Attributes
logger_
| static |
Logger scoped to HealthManager.
- Initialiser
Definition at line 69 of file HealthManager.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.