-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntity.h
105 lines (85 loc) · 1.31 KB
/
Entity.h
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef __ENTITY_H__
#define __ENTITY_H__
#include "Module.h"
#include "p2Point.h"
#include "SString.h"
#include "ModuleInput.h"
#include "ModuleRender.h"
#include "Application.h"
class PhysBody;
enum class EntityType
{
BALL,
FLIPPERS,
WALL,
BLUE_25,
YELLOW_50,
RED_100,
DIAMOND,
TRIANGLE,
FRANKFURT,
UNKNOWN
};
class Entity
{
public:
Entity(EntityType type, Application* App = nullptr) : type(type), active(true) {}
virtual bool Awake()
{
return true;
}
virtual bool Start()
{
return true;
}
virtual bool Update()
{
return true;
}
virtual bool PostUpdate()
{
return true;
}
virtual bool CleanUp()
{
return true;
}
/*virtual bool LoadState(pugi::xml_node&)
{
return true;
}
virtual bool SaveState(pugi::xml_node&)
{
return true;
}*/
void Entity::Enable()
{
if (!active)
{
active = true;
Start();
}
}
void Entity::Disable()
{
if (active)
{
active = false;
CleanUp();
}
}
virtual void OnCollision(PhysBody* physA, PhysBody* physB) {
};
public:
Application* app;
SString name;
EntityType type;
bool active = true;
//pugi::xml_node parameters;
// Possible properties, it depends on how generic we
// want our Entity class, maybe it's not renderable...
iPoint position;
bool renderable = true;
int intensity;
};
#endif // __ENTITY_H__