Skip to main content

LastDamageComponent Class

Component that stores information about the last damage received. More...

Declaration

class helios::engine::mechanics::damage::components::LastDamageComponent { ... }

Public Constructors Index

LastDamageComponent ()=default
LastDamageComponent (const LastDamageComponent &other)=default

Copy constructor (creates empty state). More...

LastDamageComponent (LastDamageComponent &&) noexcept=default

Public Operators Index

LastDamageComponent &operator= (const LastDamageComponent &)=default
LastDamageComponent &operator= (LastDamageComponent &&) noexcept=default

Public Member Functions Index

boolisEnabled () const noexcept

Checks whether this component is enabled. More...

voidenable () noexcept

Enables this component. More...

voiddisable () noexcept

Disables this component. More...

voidsetDamageContext (const DamageContext &damageContext) noexcept

Sets the last damage context. More...

DamageContextdamageContext () const noexcept

Returns the last damage context. More...

voidreset ()

Resets the component to its initial state. More...

voidonAcquire () noexcept

Called when this entity is acquired from a pool. More...

voidonRelease () noexcept

Called when this entity is released back to a pool. More...

Private Member Attributes Index

helios::engine::common::types::DamageContextdamageContext_ {}

Context of the most recent damage received. More...

boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component that stores information about the last damage received.

Used to track which entity last dealt damage to this entity. This enables attribution of kills for scoring and other game logic. The damage context is updated by the damage system when damage is applied.

Definition at line 24 of file LastDamageComponent.ixx.

Public Constructors

LastDamageComponent()

helios::engine::mechanics::damage::components::LastDamageComponent::LastDamageComponent ()
default

Definition at line 63 of file LastDamageComponent.ixx.

Referenced by LastDamageComponent, LastDamageComponent, operator= and operator=.

LastDamageComponent()

helios::engine::mechanics::damage::components::LastDamageComponent::LastDamageComponent (const LastDamageComponent & other)
default

Copy constructor (creates empty state).

Parameters
other

The component to copy from (state is not copied).

Definition at line 70 of file LastDamageComponent.ixx.

Reference LastDamageComponent.

LastDamageComponent()

helios::engine::mechanics::damage::components::LastDamageComponent::LastDamageComponent (LastDamageComponent &&)
noexcept default

Definition at line 73 of file LastDamageComponent.ixx.

Reference LastDamageComponent.

Public Operators

operator=()

LastDamageComponent & helios::engine::mechanics::damage::components::LastDamageComponent::operator= (const LastDamageComponent &)
default

Definition at line 72 of file LastDamageComponent.ixx.

Reference LastDamageComponent.

operator=()

LastDamageComponent & helios::engine::mechanics::damage::components::LastDamageComponent::operator= (LastDamageComponent &&)
noexcept default

Definition at line 74 of file LastDamageComponent.ixx.

Reference LastDamageComponent.

Public Member Functions

damageContext()

DamageContext helios::engine::mechanics::damage::components::LastDamageComponent::damageContext ()
inline nodiscard noexcept

Returns the last damage context.

Returns

The stored AttackContext.

Definition at line 90 of file LastDamageComponent.ixx.

90 [[nodiscard]] DamageContext damageContext() const noexcept {
91 return damageContext_;
92 }

Referenced by setDamageContext.

disable()

void helios::engine::mechanics::damage::components::LastDamageComponent::disable ()
inline noexcept

Disables this component.

Definition at line 59 of file LastDamageComponent.ixx.

59 void disable() noexcept {
60 isEnabled_ = false;
61 }

enable()

void helios::engine::mechanics::damage::components::LastDamageComponent::enable ()
inline noexcept

Enables this component.

Definition at line 52 of file LastDamageComponent.ixx.

52 void enable() noexcept {
53 isEnabled_ = true;
54 }

isEnabled()

bool helios::engine::mechanics::damage::components::LastDamageComponent::isEnabled ()
inline nodiscard noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 45 of file LastDamageComponent.ixx.

45 [[nodiscard]] bool isEnabled() const noexcept {
46 return isEnabled_;
47 }

onAcquire()

void helios::engine::mechanics::damage::components::LastDamageComponent::onAcquire ()
inline noexcept

Called when this entity is acquired from a pool.

Resets the damage context to ensure no stale data.

Definition at line 106 of file LastDamageComponent.ixx.

106 void onAcquire() noexcept {
107 reset();
108 }

Reference reset.

onRelease()

void helios::engine::mechanics::damage::components::LastDamageComponent::onRelease ()
inline noexcept

Called when this entity is released back to a pool.

Resets the damage context to ensure no stale data.

Definition at line 115 of file LastDamageComponent.ixx.

115 void onRelease() noexcept {
116 reset();
117 }

Reference reset.

reset()

void helios::engine::mechanics::damage::components::LastDamageComponent::reset ()
inline

Resets the component to its initial state.

Definition at line 97 of file LastDamageComponent.ixx.

97 void reset() {
98 damageContext_ = {};
99 }

Referenced by onAcquire and onRelease.

setDamageContext()

void helios::engine::mechanics::damage::components::LastDamageComponent::setDamageContext (const DamageContext & damageContext)
inline noexcept

Sets the last damage context.

Parameters
damageContext

The damage context to store.

Definition at line 81 of file LastDamageComponent.ixx.

82 damageContext_ = damageContext;
83 }

References damageContext and setDamageContext.

Referenced by setDamageContext.

Private Member Attributes

damageContext_

helios::engine::common::types::DamageContext helios::engine::mechanics::damage::components::LastDamageComponent::damageContext_ {}

Context of the most recent damage received.

Definition at line 31 of file LastDamageComponent.ixx.

isEnabled_

bool helios::engine::mechanics::damage::components::LastDamageComponent::isEnabled_ = true

Whether this component is enabled.

Definition at line 36 of file LastDamageComponent.ixx.

36 bool isEnabled_ = true;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.