Skip to main content

HealthDepletedEvent Class

Event emitted when an entity's health reaches zero. More...

Declaration

class helios::engine::mechanics::health::events::HealthDepletedEvent { ... }

Public Constructors Index

HealthDepletedEvent (const helios::engine::ecs::EntityHandle source, std::optional< DamageContext > damageContext=std::nullopt)

Constructs a HealthDepletedEvent. More...

Public Member Functions Index

std::optional< DamageContext >damageContext () const noexcept

Returns the damage context if available. More...

helios::engine::ecs::EntityHandlesource () const noexcept

Returns the handle of the deceased entity. More...

Private Member Attributes Index

helios::engine::ecs::EntityHandlesource_

Handle of the entity that died. More...

std::optional< DamageContext >damageContext_

Attack context if death was caused by combat. More...

Description

Event emitted when an entity's health reaches zero.

Contains the handle of the deceased entity and optionally the attack context if the death was caused by combat damage.

Definition at line 28 of file HealthDepletedEvent.ixx.

Public Constructors

HealthDepletedEvent()

helios::engine::mechanics::health::events::HealthDepletedEvent::HealthDepletedEvent (const helios::engine::ecs::EntityHandle source, std::optional< DamageContext > damageContext=std::nullopt)
inline explicit

Constructs a HealthDepletedEvent.

Parameters
source

Handle of the deceased entity.

damageContext

Optional damage context if death was from damage applied.

Definition at line 49 of file HealthDepletedEvent.ixx.

51 std::optional<DamageContext> damageContext = std::nullopt
52 ) : damageContext_(damageContext), source_(source) {}

References damageContext and source.

Public Member Functions

damageContext()

std::optional< DamageContext > helios::engine::mechanics::health::events::HealthDepletedEvent::damageContext ()
inline nodiscard noexcept

Returns the damage context if available.

Returns

Optional DamageContext, or nullopt if death was not from combat.

Definition at line 59 of file HealthDepletedEvent.ixx.

59 [[nodiscard]] std::optional<DamageContext> damageContext() const noexcept {
60 return damageContext_;
61 }

Referenced by HealthDepletedEvent.

source()

helios::engine::ecs::EntityHandle helios::engine::mechanics::health::events::HealthDepletedEvent::source ()
inline nodiscard noexcept

Returns the handle of the deceased entity.

Returns

The source entity handle.

Definition at line 68 of file HealthDepletedEvent.ixx.

68 [[nodiscard]] helios::engine::ecs::EntityHandle source() const noexcept {
69 return source_;
70 }

Referenced by HealthDepletedEvent.

Private Member Attributes

damageContext_

std::optional<DamageContext> helios::engine::mechanics::health::events::HealthDepletedEvent::damageContext_

Attack context if death was caused by combat.

Definition at line 38 of file HealthDepletedEvent.ixx.

38 std::optional<DamageContext> damageContext_;

source_

helios::engine::ecs::EntityHandle helios::engine::mechanics::health::events::HealthDepletedEvent::source_

Handle of the entity that died.

Definition at line 33 of file HealthDepletedEvent.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.