|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
The entity class is the base class of everything which is attached to a scene. If it is part of a scene it is an entity. More...
#include <Entity.h>
Public Member Functions | |
| Entity () | |
| virtual | ~Entity () |
| void | enableTick (bool enable) |
| Enables or disables ticking for this entity. | |
| void | tick (double deltaTime) override |
| Executes every frame if tick is enabled. | |
| template<typename T, typename... Args> | |
| T * | addComponent (Args &&... args) |
| Adds a component to the entity. Checks for uniqueness if the component defines 'static constexpr bool IsUnique = true;'. | |
| template<typename T> | |
| T * | getComponent () const |
| Returns the first component of type T found. | |
| template<typename T> | |
| std::vector< T * > | getComponents () const |
| Returns all components of type T. | |
| void | removeComponent (LogicComponent *component) |
| Removes a specific component instance. | |
| template<typename T> | |
| bool | removeFirstComponent () |
| Removes the first component of type T found. | |
| template<typename T> | |
| bool | hasComponent () const |
| Checks if a component of type T exists. | |
| bool | canTick () const |
| Tells you if the entity can execute its tick function. | |
| bool | canEverTick () const |
| Tells if this entity can ever tick. | |
| Public Member Functions inherited from EngineCore::ITickable | |
| virtual | ~ITickable ()=default |
| virtual void | preTick () |
| Function which executes immediately before the execution of ITickable::preTick() | |
| virtual void | postTick () |
| Function which executes immediately after the execution of ITickable::postTick() | |
Protected Member Functions | |
| uuids::uuid | getUUID () const |
| Getter for the UUID of this entity. | |
| std::string | getUuidString () const |
| Getter for the UUID of this entity as a string. | |
Protected Attributes | |
| std::vector< std::shared_ptr< LogicComponent > > | components |
| List of all logical components. | |
| entt::entity | data = entt::null |
| bool | allowTicking = false |
Private Attributes | |
| uuids::uuid | uuid |
The entity class is the base class of everything which is attached to a scene. If it is part of a scene it is an entity.
| EngineCore::Entity::Entity | ( | ) |
Definition at line 7 of file Entity.cpp.
References allowTicking, data, EngineCore::UuidSingleton::generate(), Ecs::RegistryManager::get(), EngineCore::UuidSingleton::instance(), and uuid.
Referenced by EngineCore::Actor::Actor().
|
virtual |
Definition at line 13 of file Entity.cpp.
References canTick(), and enableTick().
|
inline |
Adds a component to the entity. Checks for uniqueness if the component defines 'static constexpr bool IsUnique = true;'.
| T | The type of component to add (must derive from LogicComponent). |
| Args | Arguments to forward to the component constructor. |
Definition at line 44 of file Entity.h.
References components, and getComponent().
Referenced by EngineCore::Rat::Rat(), and EngineCore::StaticMeshActor::StaticMeshActor().
|
nodiscard |
Tells if this entity can ever tick.
Definition at line 44 of file Entity.cpp.
References allowTicking.
|
nodiscard |
Tells you if the entity can execute its tick function.
Definition at line 35 of file Entity.cpp.
References allowTicking, data, and Ecs::RegistryManager::get().
Referenced by ~Entity().
| void EngineCore::Entity::enableTick | ( | bool | enable | ) |
Enables or disables ticking for this entity.
| enable | disable or enable ticking |
Definition at line 18 of file Entity.cpp.
References data, and Ecs::RegistryManager::get().
Referenced by ~Entity().
|
inline |
Returns the first component of type T found.
Definition at line 73 of file Entity.h.
References components.
Referenced by addComponent(), hasComponent(), and EngineCore::CollisionComponent::registerWithBody().
|
inline |
Returns all components of type T.
Definition at line 88 of file Entity.h.
References components.
Referenced by EngineCore::PhysicsBodyComponent::beginPlay().
|
inlineprotected |
|
protected |
Getter for the UUID of this entity as a string.
Definition at line 49 of file Entity.cpp.
References uuid.
|
inline |
Checks if a component of type T exists.
Definition at line 138 of file Entity.h.
References getComponent().
|
inline |
Removes a specific component instance.
| component | Pointer to the component to remove. |
Definition at line 103 of file Entity.h.
References components.
|
inline |
Removes the first component of type T found.
Definition at line 119 of file Entity.h.
References components.
|
overridevirtual |
Executes every frame if tick is enabled.
| deltaTime | time between the last frame and this frame |
Reimplemented from EngineCore::ITickable.
Definition at line 31 of file Entity.cpp.
References EngineCore::ITickable::tick().
Referenced by EngineCore::Actor::tick().
|
protected |
Definition at line 179 of file Entity.h.
Referenced by canEverTick(), canTick(), and Entity().
|
protected |
List of all logical components.
Definition at line 175 of file Entity.h.
Referenced by addComponent(), EngineCore::Actor::beginPlay(), EngineCore::Actor::cleanupComponents(), EngineCore::Actor::endPlay(), getComponent(), getComponents(), removeComponent(), removeFirstComponent(), and EngineCore::Actor::tick().
|
protected |
Definition at line 177 of file Entity.h.
Referenced by canTick(), enableTick(), EngineCore::Actor::endPlay(), Entity(), EngineCore::Rat::Rat(), and EngineCore::StaticMeshActor::StaticMeshActor().
|
private |
Definition at line 181 of file Entity.h.
Referenced by Entity(), getUUID(), and getUuidString().