Skip to main content

EmittedByComponent Class

Component that tracks which entity emitted/spawned this object. More...

Declaration

class helios::engine::mechanics::spawn::components::EmittedByComponent { ... }

Public Constructors Index

EmittedByComponent ()=default

Default constructor. More...

EmittedByComponent (const EmittedByComponent &other)

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

EmittedByComponent (EmittedByComponent &&) noexcept=default

Public Operators Index

EmittedByComponent &operator= (const EmittedByComponent &)=default
EmittedByComponent &operator= (EmittedByComponent &&) 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...

voidsetSource (const helios::engine::ecs::EntityHandle source) noexcept

Sets the source entity that emitted this object. More...

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

Returns the handle of the source entity. 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::ecs::EntityHandlesource_ {}

Handle of the entity that emitted this object. More...

boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component that tracks which entity emitted/spawned this object.

Used to establish a relationship between a spawned entity (e.g., a projectile) and its source entity (e.g., the player or enemy that fired it). This enables game logic to attribute actions like damage or scoring to the correct source.

Definition at line 26 of file EmittedByComponent.ixx.

Public Constructors

EmittedByComponent()

helios::engine::mechanics::spawn::components::EmittedByComponent::EmittedByComponent ()
default

Default constructor.

Definition at line 66 of file EmittedByComponent.ixx.

Referenced by EmittedByComponent, EmittedByComponent, operator= and operator=.

EmittedByComponent()

helios::engine::mechanics::spawn::components::EmittedByComponent::EmittedByComponent (const EmittedByComponent & other)
inline

Copy constructor (creates empty state).

Parameters
other

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

Definition at line 73 of file EmittedByComponent.ixx.

Reference EmittedByComponent.

EmittedByComponent()

helios::engine::mechanics::spawn::components::EmittedByComponent::EmittedByComponent (EmittedByComponent &&)
noexcept default

Definition at line 76 of file EmittedByComponent.ixx.

Reference EmittedByComponent.

Public Operators

operator=()

EmittedByComponent & helios::engine::mechanics::spawn::components::EmittedByComponent::operator= (const EmittedByComponent &)
default

Definition at line 75 of file EmittedByComponent.ixx.

Reference EmittedByComponent.

operator=()

EmittedByComponent & helios::engine::mechanics::spawn::components::EmittedByComponent::operator= (EmittedByComponent &&)
noexcept default

Definition at line 77 of file EmittedByComponent.ixx.

Reference EmittedByComponent.

Public Member Functions

disable()

void helios::engine::mechanics::spawn::components::EmittedByComponent::disable ()
inline noexcept

Disables this component.

Definition at line 59 of file EmittedByComponent.ixx.

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

enable()

void helios::engine::mechanics::spawn::components::EmittedByComponent::enable ()
inline noexcept

Enables this component.

Definition at line 52 of file EmittedByComponent.ixx.

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

isEnabled()

bool helios::engine::mechanics::spawn::components::EmittedByComponent::isEnabled ()
inline nodiscard noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 45 of file EmittedByComponent.ixx.

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

onAcquire()

void helios::engine::mechanics::spawn::components::EmittedByComponent::onAcquire ()
inline noexcept

Called when this entity is acquired from a pool.

Resets the source handle to prevent stale references.

Definition at line 109 of file EmittedByComponent.ixx.

109 void onAcquire() noexcept {
110 reset();
111 }

Reference reset.

onRelease()

void helios::engine::mechanics::spawn::components::EmittedByComponent::onRelease ()
inline noexcept

Called when this entity is released back to a pool.

Resets the source handle to prevent stale references.

Definition at line 118 of file EmittedByComponent.ixx.

118 void onRelease() noexcept {
119 reset();
120 }

Reference reset.

reset()

void helios::engine::mechanics::spawn::components::EmittedByComponent::reset ()
inline

Resets the component to its initial state.

Definition at line 100 of file EmittedByComponent.ixx.

100 void reset() {
102 }

Referenced by onAcquire and onRelease.

setSource()

void helios::engine::mechanics::spawn::components::EmittedByComponent::setSource (const helios::engine::ecs::EntityHandle source)
inline noexcept

Sets the source entity that emitted this object.

Parameters
source

Handle of the emitting entity.

Definition at line 84 of file EmittedByComponent.ixx.

84 void setSource(const helios::engine::ecs::EntityHandle source) noexcept {
85 source_ = source;
86 }

References setSource and source.

Referenced by setSource.

source()

helios::engine::ecs::EntityHandle helios::engine::mechanics::spawn::components::EmittedByComponent::source ()
inline nodiscard noexcept

Returns the handle of the source entity.

Returns

Handle of the entity that emitted this object.

Definition at line 93 of file EmittedByComponent.ixx.

93 [[nodiscard]] helios::engine::ecs::EntityHandle source() const noexcept {
94 return source_;
95 }

Referenced by setSource.

Private Member Attributes

isEnabled_

bool helios::engine::mechanics::spawn::components::EmittedByComponent::isEnabled_ = true

Whether this component is enabled.

Definition at line 36 of file EmittedByComponent.ixx.

36 bool isEnabled_ = true;

source_

helios::engine::ecs::EntityHandle helios::engine::mechanics::spawn::components::EmittedByComponent::source_ {}

Handle of the entity that emitted this object.

Definition at line 31 of file EmittedByComponent.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.