Skip to main content

SpawnedByProfileComponent Class

Component that stores the spawn profile ID that created this GameObject. More...

Declaration

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

Public Constructors Index

SpawnedByProfileComponent ()=default

Default constructor. More...

SpawnedByProfileComponent (const SpawnedByProfileComponent &other)

Copy constructor for cloning. More...

SpawnedByProfileComponent (SpawnedByProfileComponent &&) noexcept=default

Public Operators Index

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

helios::engine::core::data::SpawnProfileIdspawnProfileId () const noexcept

Returns the spawn profile ID. More...

voidsetSpawnProfileId (const helios::engine::core::data::SpawnProfileId &spawnProfileId) noexcept

Sets the spawn profile ID. More...

Private Member Attributes Index

helios::engine::core::data::SpawnProfileIdspawnProfileId_ {helios::core::types::no_init}

The spawn profile ID that created this entity. More...

boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component that stores the spawn profile ID that created this GameObject.

SpawnedByProfileComponent is attached to pooled GameObjects to track which spawn profile they belong to. This enables the despawn system to route release requests to the correct pool manager.

The component is cloneable, allowing prefab-based pooling where the profile ID is set after cloning during the acquire phase.

Example usage: ```cpp // During prefab setup auto prefab = gameWorld.addGameObject(); prefab.add<SpawnedByProfileComponent>();

// During spawn (in SpawnManager) auto* comp = entity.get<SpawnedByProfileComponent>(); comp->setSpawnProfileId(profileId);

// During despawn auto profileId = entity.get<SpawnedByProfileComponent>()->spawnProfileId(); poolManager.release(profileId, entity.entityHandle()); ```

See Also

SpawnProfileId

See Also

GameObjectPoolManager

Definition at line 43 of file SpawnedByProfileComponent.ixx.

Public Constructors

SpawnedByProfileComponent()

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

Default constructor.

Definition at line 85 of file SpawnedByProfileComponent.ixx.

Referenced by operator=, operator=, SpawnedByProfileComponent and SpawnedByProfileComponent.

SpawnedByProfileComponent()

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

Copy constructor for cloning.

Parameters
other

The component to copy from.

Definition at line 92 of file SpawnedByProfileComponent.ixx.

93 : spawnProfileId_(other.spawnProfileId_) {}

Reference SpawnedByProfileComponent.

SpawnedByProfileComponent()

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

Definition at line 96 of file SpawnedByProfileComponent.ixx.

Reference SpawnedByProfileComponent.

Public Operators

operator=()

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

Definition at line 95 of file SpawnedByProfileComponent.ixx.

Reference SpawnedByProfileComponent.

operator=()

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

Definition at line 97 of file SpawnedByProfileComponent.ixx.

Reference SpawnedByProfileComponent.

Public Member Functions

disable()

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

Disables this component.

Definition at line 78 of file SpawnedByProfileComponent.ixx.

78 void disable() noexcept {
79 isEnabled_ = false;
80 }

enable()

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

Enables this component.

Definition at line 71 of file SpawnedByProfileComponent.ixx.

71 void enable() noexcept {
72 isEnabled_ = true;
73 }

isEnabled()

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

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 64 of file SpawnedByProfileComponent.ixx.

64 [[nodiscard]] bool isEnabled() const noexcept {
65 return isEnabled_;
66 }

setSpawnProfileId()

void helios::engine::mechanics::spawn::components::SpawnedByProfileComponent::setSpawnProfileId (const helios::engine::core::data::SpawnProfileId & spawnProfileId)
inline noexcept

Sets the spawn profile ID.

Called by the spawn manager after acquiring an entity from the pool to associate it with the correct profile for later despawning.

Parameters
spawnProfileId

The profile ID to assign.

Definition at line 116 of file SpawnedByProfileComponent.ixx.

Reference spawnProfileId.

spawnProfileId()

helios::engine::core::data::SpawnProfileId helios::engine::mechanics::spawn::components::SpawnedByProfileComponent::spawnProfileId ()
inline nodiscard noexcept

Returns the spawn profile ID.

Returns

The SpawnProfileId assigned to this entity.

Definition at line 104 of file SpawnedByProfileComponent.ixx.

104 [[nodiscard]] helios::engine::core::data::SpawnProfileId spawnProfileId() const noexcept {
105 return spawnProfileId_;
106 }

Reference spawnProfileId.

Referenced by setSpawnProfileId and spawnProfileId.

Private Member Attributes

isEnabled_

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

Whether this component is enabled.

Definition at line 55 of file SpawnedByProfileComponent.ixx.

55 bool isEnabled_ = true;

spawnProfileId_

helios::engine::core::data::SpawnProfileId helios::engine::mechanics::spawn::components::SpawnedByProfileComponent::spawnProfileId_ {helios::core::types::no_init}

The spawn profile ID that created this entity.

Default-initialized to 0, which represents an invalid/unassigned profile.

Definition at line 50 of file SpawnedByProfileComponent.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.