diff --git a/SHADE_Engine/src/ECS_Base/Entity/SHEntity.cpp b/SHADE_Engine/src/ECS_Base/Entity/SHEntity.cpp index 6005fb01..08139158 100644 --- a/SHADE_Engine/src/ECS_Base/Entity/SHEntity.cpp +++ b/SHADE_Engine/src/ECS_Base/Entity/SHEntity.cpp @@ -28,7 +28,7 @@ namespace SHADE //SHEntityManager::RemoveEntity(this->entityID); } - EntityID SHEntity::GetEID() noexcept + EntityID SHEntity::GetEID()const noexcept { return this->entityID; } @@ -39,6 +39,10 @@ namespace SHADE SHComponentManager::SetActive(entityID, active); } + bool SHEntity::GetActive(void) const noexcept + { + return isActive; + } void SHEntity::SetParent(SHEntity* newParent) noexcept @@ -53,20 +57,20 @@ namespace SHADE //TODO } - SHEntity* SHEntity::GetParent() noexcept + SHEntity* SHEntity::GetParent()const noexcept { //TODO return nullptr; } - std::vectorconst& SHEntity::GetChildren() noexcept + std::vectorconst& SHEntity::GetChildren()const noexcept { //TODO return std::vector{}; } - std::vectorconst& SHEntity::GetChildrenID() noexcept + std::vectorconst& SHEntity::GetChildrenID()const noexcept { return std::vector{}; } diff --git a/SHADE_Engine/src/ECS_Base/Entity/SHEntity.h b/SHADE_Engine/src/ECS_Base/Entity/SHEntity.h index d499042c..0e00c8af 100644 --- a/SHADE_Engine/src/ECS_Base/Entity/SHEntity.h +++ b/SHADE_Engine/src/ECS_Base/Entity/SHEntity.h @@ -63,7 +63,7 @@ namespace SHADE * Returns nullptr if the entity does not have such Component. ***************************************************************************/ template - std::enable_if_t, T*> GetComponent() noexcept + std::enable_if_t, T*> GetComponent()const noexcept { return SHComponentManager::GetComponent_s(entityID); @@ -77,7 +77,7 @@ namespace SHADE * \return uint32_t * The entityID of this Entity object. ***************************************************************************/ - EntityID GetEID() noexcept; + EntityID GetEID()const noexcept; /*!************************************************************************* * \brief Set the Active object @@ -91,6 +91,7 @@ namespace SHADE ***************************************************************************/ virtual void SetActive(bool active) noexcept; + bool GetActive(void)const noexcept; /************************************************************************** @@ -124,7 +125,7 @@ namespace SHADE * Returns a pointer to the parent entity. * Returns a nullptr if the parent node is the root node. ***************************************************************************/ - SHEntity* GetParent() noexcept; + SHEntity* GetParent()const noexcept; /************************************************************************** @@ -133,7 +134,7 @@ namespace SHADE * \return * Return a vector of SHEntity pointers of the children belonging to this entity. ***************************************************************************/ - std::vectorconst& GetChildren() noexcept; + std::vectorconst& GetChildren()const noexcept; /************************************************************************** * \brief @@ -141,11 +142,13 @@ namespace SHADE * \return * return a vector of EntityID of the children belonging to this entity. ***************************************************************************/ - std::vectorconst& GetChildrenID() noexcept; - + std::vectorconst& GetChildrenID()const noexcept; + //Name of the entity. This name is non-unique and only used for the editor. std::string name; - bool isActive; + + + private: @@ -156,6 +159,11 @@ namespace SHADE EntityID entityID; + //Entity active state. This should only be set using the SetActive function which will + //set the active state of all components of this entity. + bool isActive; + + }; }