-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathAsyncBehaviour.cpp
More file actions
72 lines (56 loc) · 1.44 KB
/
Copy pathAsyncBehaviour.cpp
File metadata and controls
72 lines (56 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "AsyncBehaviour.h"
#define cpsCurrentClass AsyncBehaviourManager
cpsExportSingletonClass()
cpsExportMethod(Awake)
cpsExportMethod(OnDestroy)
cpsExportMethod(Update)
#undef cpsCurrentClass
#define cpsCurrentClass AsyncBehaviour
cpsExportClass()
cpsExportMethod(BeforeAsyncUpdate)
cpsExportMethod(AsyncUpdate)
cpsExportMethod(AfterAsyncUpdate)
#undef cpsCurrentClass
static AsyncBehaviourManager* s_instance;
/*static*/ AsyncBehaviourManager* AsyncBehaviourManager::getInstance()
{
if (!s_instance) {
s_instance = new AsyncBehaviourManager(nullptr);
}
return s_instance;
}
void AsyncBehaviourManager::Awake()
{
}
void AsyncBehaviourManager::OnDestroy()
{
}
void AsyncBehaviourManager::Update()
{
for (AsyncBehaviour *e : m_entities) {
e->BeforeAsyncUpdate();
}
//typedef tbb::blocked_range<size_t> range_t;
//tbb::parallel_for(
// range_t(size_t(0), m_entities.size(), 64),
// [&](const range_t &r){
// for (size_t i = r.begin(); i < r.end(); ++i) {
// m_entities[i]->AsyncUpdate();
// }
// });
for (auto &v : m_entities) {
v->AsyncUpdate();
}
for (AsyncBehaviour *e : m_entities) {
e->AfterAsyncUpdate();
}
}
void AsyncBehaviour::BeforeAsyncUpdate()
{
}
void AsyncBehaviour::AsyncUpdate()
{
}
void AsyncBehaviour::AfterAsyncUpdate()
{
}