blob: 45150a041ad040614b27a2e780b1ac4fa452bfe9 (
plain) (
blame)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
#ifndef TANGIBLE_H_746DB3EE
#define TANGIBLE_H_746DB3EE
#include <set>
#include "component.h"
#include "entity_manager.h"
class PonderableComponent : public Component {
public:
using id_type = EntityManager::id_type;
/**
* List of different types of physical bodies.
*
* vacuumed - Default.
* freefalling - The body will be treated as if there were a downward force
* of gravity being exerted onto it. The body will also exhibit
* terminal velocity (that is, its downward velocity will be
* capped at a constant value).
*/
enum class Type {
vacuumed,
freefalling
};
/**
* List of different types of collidable surfaces.
*/
enum class Collision {
wall,
platform,
adjacency,
warp,
danger
};
/**
* Constructor for initializing the body type, which is a constant.
*/
PonderableComponent(Type type) : type(type)
{
}
/**
* The velocity of the body.
*/
double velX = 0.0;
double velY = 0.0;
/**
* The acceleration of the body.
*/
double accelX = 0.0;
double accelY = 0.0;
/**
* The type of physical body that the entity is meant to assume. The body will
* be acted upon differently based on this. See the enumeration above for more
* details.
*
* @managed_by PonderingSystem
*/
const Type type;
/**
* Whether or not a freefalling body is in contact with the ground.
*
* @managed_by PonderingSystem
*/
bool grounded = false;
/**
* Whether or not a freefalling body is being ferried by another body.
*
* @managed_by PonderingSystem
*/
bool ferried = false;
/**
* The entity that is ferrying this body, if there is one.
*
* @managed_by PonderingSystem
*/
id_type ferry;
/**
* The location of the body relative to the location of its ferry.
*
* @managed_by PonderingSystem
*/
double relX;
double relY;
/**
* The bodies that are being ferried by this body.
*
* @managed_by PonderingSystem
*/
std::set<id_type> passengers;
/**
* If enabled, this will prevent the body from moving.
*/
bool frozen = false;
/**
* If disabled, collision detection for this body will not be performed and
* other bodies will ignore it.
*/
bool collidable = true;
/**
* The effect that colliding with this body has.
*/
Collision colliderType = Collision::wall;
/**
* If this flag is disabled, the entity will be ignored by the pondering
* system.
*
* @managed_by RealizingSystem
*/
bool active = false;
};
#endif /* end of include guard: TANGIBLE_H_746DB3EE */
|