diff --git a/include/Engine/Core/EntityWrapper.h b/include/Engine/Core/EntityWrapper.h index 74b5fc56..3ba4e087 100644 --- a/include/Engine/Core/EntityWrapper.h +++ b/include/Engine/Core/EntityWrapper.h @@ -24,6 +24,7 @@ struct EntityWrapper static const EntityWrapper Invalid; bool HasComponent(const std::string& componentName); + EntityWrapper Parent(); bool Valid(); ComponentWrapper operator[](const char* componentName); diff --git a/src/Engine/Core/EntityWrapper.cpp b/src/Engine/Core/EntityWrapper.cpp index 5dc493ff..58dd1ee6 100644 --- a/src/Engine/Core/EntityWrapper.cpp +++ b/src/Engine/Core/EntityWrapper.cpp @@ -8,6 +8,11 @@ bool EntityWrapper::HasComponent(const std::string& componentName) return World->HasComponent(ID, componentName); } +EntityWrapper EntityWrapper::Parent() +{ + return EntityWrapper(World, World->GetParent(ID)); +} + bool EntityWrapper::Valid() { if (this->World == nullptr) { @@ -38,7 +43,7 @@ ComponentWrapper EntityWrapper::operator[](const char* componentName) bool EntityWrapper::operator==(const EntityWrapper& e) const { - return (this->World == e.World) && (this->ID == e.ID); + return (this->ID == e.ID) && (this->World == e.World); } bool EntityWrapper::operator!=(const EntityWrapper& e) const