SpawnedByProfileComponent Class
Component that stores the spawn profile ID that created this GameObject. More...
Declaration
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
| bool | isEnabled () const noexcept |
|
Checks whether this component is enabled. More... | |
| void | enable () noexcept |
|
Enables this component. More... | |
| void | disable () noexcept |
|
Disables this component. More... | |
| helios::engine::core::data::SpawnProfileId | spawnProfileId () const noexcept |
|
Returns the spawn profile ID. More... | |
| void | setSpawnProfileId (const helios::engine::core::data::SpawnProfileId &spawnProfileId) noexcept |
|
Sets the spawn profile ID. More... | |
Private Member Attributes Index
| helios::engine::core::data::SpawnProfileId | spawnProfileId_ {helios::core::types::no_init} |
|
The spawn profile ID that created this entity. More... | |
| bool | isEnabled_ = 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()
| default |
Default constructor.
Definition at line 85 of file SpawnedByProfileComponent.ixx.
Referenced by operator=, operator=, SpawnedByProfileComponent and SpawnedByProfileComponent.
SpawnedByProfileComponent()
| inline |
Copy constructor for cloning.
- Parameters
-
other The component to copy from.
Definition at line 92 of file SpawnedByProfileComponent.ixx.
Reference SpawnedByProfileComponent.
SpawnedByProfileComponent()
| noexcept default |
Definition at line 96 of file SpawnedByProfileComponent.ixx.
Reference SpawnedByProfileComponent.
Public Operators
operator=()
| default |
Definition at line 95 of file SpawnedByProfileComponent.ixx.
Reference SpawnedByProfileComponent.
operator=()
| noexcept default |
Definition at line 97 of file SpawnedByProfileComponent.ixx.
Reference SpawnedByProfileComponent.
Public Member Functions
disable()
| inline noexcept |
Disables this component.
Definition at line 78 of file SpawnedByProfileComponent.ixx.
enable()
| inline noexcept |
Enables this component.
Definition at line 71 of file SpawnedByProfileComponent.ixx.
isEnabled()
| inline nodiscard noexcept |
Checks whether this component is enabled.
- Returns
True if enabled, false otherwise.
Definition at line 64 of file SpawnedByProfileComponent.ixx.
setSpawnProfileId()
| 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()
| inline nodiscard noexcept |
Returns the spawn profile ID.
- Returns
The SpawnProfileId assigned to this entity.
Definition at line 104 of file SpawnedByProfileComponent.ixx.
Reference spawnProfileId.
Referenced by setSpawnProfileId and spawnProfileId.
Private Member Attributes
isEnabled_
|
Whether this component is enabled.
Definition at line 55 of file SpawnedByProfileComponent.ixx.
spawnProfileId_
|
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.