Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
IEntity.cpp
Go to the documentation of this file.
1
2/*
3 Author : Tobias Stein
4 Date : 3rd July, 2016
5 File : Entity.cpp
6
7 Entity class.
8
9 All Rights Reserved. (c) Copyright 2016.
10*/
11
12#include "IEntity.h"
13#include "ComponentManager.h"
14
15namespace ECS
16{
17 std::shared_mutex IEntity::s_ComponentManagerLock;
18
20
22 m_Active(true)
23 {}
24
26 {}
27
28 void IEntity::SetActive(bool active)
29 {
30 if (this->m_Active == active)
31 return;
32
33 if (active == false)
34 {
35 this->OnDisable();
36 }
37 else
38 {
39 this->OnEnable();
40 }
41
42 this->m_Active = active;
43 }
44
46 {
47 std::scoped_lock<std::shared_mutex> r_lock(s_ComponentManagerLock);
49 }
50
52 {
53 std::shared_lock<std::shared_mutex> r_lock(s_ComponentManagerLock);
55 }
56}
#define DEFINE_STATIC_LOGGER(clazz, name)
Definition: LoggerMacro.h:19
void PassDataToAllComponents(const EntityId entityId, const CustomEvent &data)
void RemoveAllComponents(const EntityId entityId)
bool m_Active
Definition: IEntity.h:46
ComponentManager * m_ComponentManagerInstance
Definition: IEntity.h:34
void SetActive(bool active)
Definition: IEntity.cpp:28
virtual void OnEnable()
Definition: IEntity.h:93
DECLARE_STATIC_LOGGER EntityId m_EntityID
Definition: IEntity.h:43
void RemoveAllComponents()
Definition: IEntity.cpp:45
static std::shared_mutex s_ComponentManagerLock
Definition: IEntity.h:47
virtual void OnDisable()
Definition: IEntity.h:94
void PassDataToAllComponents(const ECS::CustomEvent &evt)
Definition: IEntity.cpp:51
virtual ~IEntity()
Definition: IEntity.cpp:25