Line | |
---|
1 | /** |
---|
2 | @file NPC.h |
---|
3 | @brief AI using WorldEntity |
---|
4 | @author Benjamin Knecht <beni_at_orxonox.net> |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef MODULE_NPC_H |
---|
8 | #define MODULE_NPC_H |
---|
9 | |
---|
10 | // includes |
---|
11 | #include "WorldEntity.h" |
---|
12 | #include "Model.h" |
---|
13 | |
---|
14 | namespace orxonox { |
---|
15 | |
---|
16 | class NPC : public Model |
---|
17 | { |
---|
18 | public: |
---|
19 | |
---|
20 | NPC(); |
---|
21 | virtual ~NPC(); |
---|
22 | void tick(float dt); |
---|
23 | void update(); |
---|
24 | void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable); |
---|
25 | |
---|
26 | private: |
---|
27 | float getDistance(NPC* temp); |
---|
28 | void calculateAcceleration(NPC** arrayOfElements); |
---|
29 | Vector3 separation(NPC** arrayOfElements); |
---|
30 | Vector3 alignment(NPC** arrayOfElements); |
---|
31 | Vector3 cohesion(NPC** arrayOfElements); |
---|
32 | |
---|
33 | |
---|
34 | private: |
---|
35 | bool movable_; // movability of the element, (false) gives the possiblity that an object can`t be moved by flocking but still gets into the calculation |
---|
36 | |
---|
37 | // those values should maybe be controlled by a higher power and should maybe be parameters that can be changed |
---|
38 | static int const SEPERATIONDISTANCE = 300; //detectionradius of seperation |
---|
39 | static int const ALIGNMENTDISTANCE = 300; //detectionradius of alignment |
---|
40 | static int const COHESIONDISTANCE = 5000; //detectionradius of cohesion |
---|
41 | static int const ANZELEMENTS = 9; //number of elements |
---|
42 | }; |
---|
43 | |
---|
44 | } |
---|
45 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.