Class Engine::HierarchySystem¶
ClassList > Engine > HierarchySystem
Propagates parent Position deltas to relative children each frame.More...
#include <HierarchySystem.hpp>
Inherits the following classes: Engine::System
Public Attributes inherited from Engine::System¶
See Engine::System
| Type | Name |
|---|---|
| std::set< Entity > | m_Entities |
Public Functions¶
| Type | Name |
|---|---|
| virtual void | Update (Registry & registry, float dt) override Applies parent motion to relative children for all hierarchy roots. |
Public Functions inherited from Engine::System¶
See Engine::System
| Type | Name |
|---|---|
| virtual void | OnSceneUnloaded (Registry & registry) Called right before the current scene's entities are destroyed. |
| virtual void | Render (Registry & registry) World pass: drawn inside the active camera. |
| virtual void | RenderScreen (Registry & registry) Screen pass: drawn after the world, in window pixels. |
| virtual void | Update (Registry & registry, float dt) |
| virtual | ~System () = default |
Public Static Functions¶
| Type | Name |
|---|---|
| std::vector< Entity > | FindDirectChildren (Registry & registry, Entity node) Returns entities whose Parent::parent equals node . |
| std::vector< Entity > | FindHierarchyRoots (Registry & registry) Returns hierarchy roots (referenced as parent, with no Parent of their own). |
| void | TeleportWithChildren (Registry & registry, Entity entity, float x, float y) Moves entity to (x ,y ) at once, without a frame delta. |
Detailed Description¶
Discovers hierarchy from Parent components only (no stored child lists). Runs one subtree walk per hierarchy root (entity referenced as parent with no Parent of its own). At each node, applies that node's frame delta to direct children with Position::relative set, then recurses regardless of zero delta.
Note:
Must run before PositionSystem in the registry update order so child positions are updated before prevX/prevY/prevZ are snapshotted.
Public Functions Documentation¶
function Update¶
Applies parent motion to relative children for all hierarchy roots.
Parameters:
registryECS registry with Parent and Position registered.dtDelta time (unused; kept for System API).
Implements Engine::System::Update
Public Static Functions Documentation¶
function FindDirectChildren¶
Returns entities whose Parent::parent equalsnode .
static std::vector< Entity > Engine::HierarchySystem::FindDirectChildren (
Registry & registry,
Entity node
)
function FindHierarchyRoots¶
Returns hierarchy roots (referenced as parent, with no Parent of their own).
function TeleportWithChildren¶
Moves entity to (x ,y ) at once, without a frame delta.
static void Engine::HierarchySystem::TeleportWithChildren (
Registry & registry,
Entity entity,
float x,
float y
)
Relative descendants are shifted by the same amount right away, so a multi-part entity (e.g. a prefab with child parts) stays in one piece. prevX/prevY are updated too, so the next Update does not move anything a second time.
The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Systems/HierarchySystem.hpp