Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Entity.cpp
Go to the documentation of this file.
4
5
6namespace EngineCore {
9 entt::registry& registry = Ecs::RegistryManager::get();
10 data = registry.create();
11 }
12
14 if (canTick())
15 enableTick( false );
16 }
17
18 void Entity::enableTick( bool enable )
19 {
20 auto& registry = Ecs::RegistryManager::get();
21 if (enable)
22 {
23 registry.emplace<Ecs::Tick>(data, this);
24 }
25 else
26 {
27 registry.remove<Ecs::Tick>(data);
28 }
29 }
30
31 void Entity::tick(double deltaTime) {
32 ITickable::tick(deltaTime);
33 }
34
35 bool Entity::canTick() const {
36 if (allowTicking)
37 {
38 auto& registry = Ecs::RegistryManager::get();
39 return registry.any_of<Ecs::Tick>(data);
40 }
41 return false;
42 }
43
45 {
46 return allowTicking;
47 }
48
49 std::string Entity::getUuidString() const {
50 if (!uuid.is_nil()) {
51 return uuids::to_string(uuid);
52 } else {
53 return "";
54 }
55
56 }
57} // namespace EngineCore
static entt::registry & get()
Gets the registry for all components.
entt::entity data
Definition Entity.h:177
bool canTick() const
Tells you if the entity can execute its tick function.
Definition Entity.cpp:35
virtual ~Entity()
Definition Entity.cpp:13
std::string getUuidString() const
Getter for the UUID of this entity as a string.
Definition Entity.cpp:49
void tick(double deltaTime) override
Executes every frame if tick is enabled.
Definition Entity.cpp:31
uuids::uuid uuid
Definition Entity.h:181
void enableTick(bool enable)
Enables or disables ticking for this entity.
Definition Entity.cpp:18
bool canEverTick() const
Tells if this entity can ever tick.
Definition Entity.cpp:44
virtual void tick(double deltaTimeSeconds)
Function called each frame when a tick component has been registered with EnTT Ecs::Tick.
Definition Tick.h:32
static UuidSingleton & instance()
Definition UuidManager.h:32
Log category system implementation.
Tag for everything which wants to receive tick events.
Definition EcsData.h:146