72 Log::Warning(fmt::format(
"Entity({}) has no Relationship component in ForEachChild", parent));
76 auto currentChildOpt = parentRS->
first;
77 while (currentChildOpt.has_value())
87 currentChildOpt = currentChildRS->
next;
98template <
typename TComponent>
101 std::vector<std::reference_wrapper<TComponent>> childComponents;
106 childComponents.emplace_back(*childComponent);
109 return childComponents;
121 std::optional<Engine::Entity> parentOpt =
GetParent(child);
122 if (!parentOpt.has_value())
124 Log::Warning(fmt::format(
"Entity({}) has no parent in TryGetParentComponent", child));
Wrapper class providing a convenient interface for entity manipulation with the Core....
Definition Entity.hpp:20
decltype(auto) TryGetComponent()
Try to get a component of type TComponent from the entity. It returns a pointer to the component if i...
Definition Entity.ipp:41
void Warning(const T &msg) noexcept(false)
Definition Logger.hpp:32
auto TryGetParentComponent(Engine::Entity child) -> TComponent *
Definition Utils.hpp:119
auto IsChildOf(Engine::Entity child, Engine::Entity parent) -> bool
Definition Utils.cpp:36
auto ForEachChild(Engine::Entity parent, TFunc func) -> void
Definition Utils.hpp:66
auto GetParent(Engine::Entity child) -> std::optional< Engine::Entity >
Definition Utils.cpp:81
auto SetChildOf(Engine::Entity child, Engine::Entity parent) -> void
Definition Utils.cpp:5
auto GetChildComponents(Engine::Entity parent) -> std::vector< std::reference_wrapper< TComponent > >
Definition Utils.hpp:99
auto RemoveParent(Engine::Entity child) -> void
Definition Utils.cpp:43
Definition Relationship.hpp:31
std::optional< Engine::Entity > next
Definition Relationship.hpp:39
std::optional< Engine::Entity > first
Definition Relationship.hpp:35