Definition at line 12 of file GameObjectMgr.h.
◆ AddDestroyObject()
void GameObjectMgr::AddDestroyObject |
( |
SGameObject * |
object | ) |
|
Definition at line 48 of file GameObjectMgr.cpp.
48 {
49 if(object->GetStatus() != SGameObject::DESTROY) return;
50 m_destroyObjectsQueue.push(object);
51}
◆ DestroyQueuedObject()
void GameObjectMgr::DestroyQueuedObject |
( |
| ) |
|
Definition at line 37 of file GameObjectMgr.cpp.
37 {
38 if (m_destroyObjectsQueue.empty()) return;
39
40 for (; !m_destroyObjectsQueue.empty(); m_destroyObjectsQueue.pop()) {
41 const auto& object = m_destroyObjectsQueue.front();
42
44 CORE->GetCore(
MemoryMgr)->ReleaseObject(
object);
45 }
46}
◆ Find()
SGameObject * GameObjectMgr::Find |
( |
const std::string & |
name | ) |
const |
Definition at line 53 of file GameObjectMgr.cpp.
53 {
54 for (const auto& pair : m_objects) {
55 const auto& object = pair.second;
56 if (object->GetName() == name)
57 return object;
58 }
59
60 return nullptr;
61
62}
◆ FindByHash()
SGameObject * GameObjectMgr::FindByHash |
( |
const std::string & |
hash | ) |
const |
Definition at line 78 of file GameObjectMgr.cpp.
78 {
79 std::string obj_hash = split(hash, '?')[0];
81}
◆ FindByID()
SGameObject * GameObjectMgr::FindByID |
( |
const std::string & |
id | ) |
const |
Definition at line 64 of file GameObjectMgr.cpp.
64 {
65 std::string obj_id = split(id, '?')[0];
66
67 for (const auto& pair : m_objects) {
68 const auto& object = pair.second;
69 if (object->isPrefab()) continue;
70 auto id_ = object->GetID();
71 if (id_ == obj_id)
72 return object;
73 }
74
75 return nullptr;
76}
◆ FindComponentByHash()
SComponent * GameObjectMgr::FindComponentByHash |
( |
const std::string & |
hash | ) |
const |
Definition at line 98 of file GameObjectMgr.cpp.
98 {
99 auto object = FindByHash(hash);
100 if (object == nullptr) return nullptr;
101
102 auto components = object->GetComponents();
103 auto split_str = split(hash, '?');
104
105 for (auto component : components) {
106 if (split_str[1] == component->GetClassType()) {
107 return component;
108 }
109 }
110 return nullptr;
111}
◆ FindComponentByID()
SComponent * GameObjectMgr::FindComponentByID |
( |
const std::string & |
id | ) |
const |
Definition at line 83 of file GameObjectMgr.cpp.
83 {
84 auto object = FindByID(id);
85 if (object == nullptr) return nullptr;
86
87 auto components = object->GetComponents();
88 auto split_str = split(id, '?');
89
90 for (auto component : components) {
91 if (split_str[1] == component->GetClassType()) {
92 return component;
93 }
94 }
95 return nullptr;
96}
◆ Init()
void GameObjectMgr::Init |
( |
| ) |
|
|
overridevirtual |
Implements CSE::CoreBase.
Definition at line 15 of file GameObjectMgr.cpp.
15 {
16
17 for (const auto& pair : m_objects) {
18 const auto& object = pair.second;
19 if (object == nullptr) continue;
20 object->Init();
21 }
22
23}
◆ Update()
void GameObjectMgr::Update |
( |
float |
elapsedTime | ) |
|
|
overridevirtual |
Reimplemented from CSE::CoreBase.
Definition at line 26 of file GameObjectMgr.cpp.
26 {
27 auto iterator = m_objects.begin();
28 while (iterator != m_objects.end()) {
29 const auto& object = iterator->second;
30 if (object == nullptr) continue;
31 object->Tick(elapsedTime);
32 ++iterator;
33 }
34}
The documentation for this class was generated from the following files: