12 #include "components/ErrorUtils.hpp"
15 #include "../../../thirdparty/uuid/UUID.hpp"
58 : m_engine(other.m_engine), m_entity(other.m_entity), m_isValid(other.m_isValid) {
60 other.m_isValid =
false;
66 virtual void Update(
float deltaTime) {}
78 template<
typename T> T&
GetComponent() {
return m_engine.getRegistry().get<T>(m_entity); }
80 template<
typename T>
void AddComponent(
const T& comp) { m_engine.getRegistry().add_or_replace<T>(m_entity, comp); }
83 template<
typename T>
bool HasComponent()
const {
return m_engine.getRegistry().has<T>(m_entity); }
84 bool isValid()
const {
return m_isValid; }
112 std::string objectType;
Contains basic components like transform, camera, name components..
Main header for the Entity Component System (ECS) framework.
Contains main Engine class.
Class for interaction with engine systems.
bool HasComponent() const
Function that checks if the GameObject has a component.
void Destroy()
Destroys the GameObject and removes it from the engine's registry.
vex::Entity GetEntity() const
Function that returns entity object, which is the entity associated with this GameObject....
virtual void BeginPlay()
virtual void function you override to implement custom behavior when the game starts.
void ParentTo(vex::Entity entity)
Function that parent this Object to another GameObject. You need to pass another GameObject's entity.
T & GetComponent()
Function that returns reference to a requested component.
GameObject(Engine &engine, const std::string &name)
Default constructor for GameObject.
virtual ~GameObject()
Destructor.
Engine & GetEngine()
Function that returns engine reference allowing your custom Object to use engine provided methods.
void AddComponent(const T &comp)
Function that adds a component to the GameObject.
const std::string & getObjectType() const
Function that returns the type of the GameObject.
void setObjectType(const std::string &type)
Function that sets the type of the GameObject.
virtual void Update(float deltaTime)
virtual void function you override to implement custom behavior when the game updates (eg....
uint32_t Entity
Type alias representing a unique entity identifier in the ECS system.
constexpr Entity NULL_ENTITY
Special entity value indicating an invalid or null entity.