[10244] | 1 | |
---|
| 2 | #ifndef _SWARM_MODULE_H |
---|
| 3 | #define _SWARM_MODULE_H |
---|
| 4 | #include "world_entity.h" |
---|
| 5 | #include "ai_module.h" |
---|
| 6 | |
---|
| 7 | class SwarmModule { |
---|
| 8 | public: |
---|
| 9 | inline SwarmModule(){taskComplete=false;} |
---|
| 10 | virtual ~SwarmModule(){} |
---|
| 11 | virtual void process(float dt){} |
---|
[10349] | 12 | |
---|
| 13 | void addAI(WorldEntity*, float maxSpeed, float attackDistance); |
---|
[10244] | 14 | void removeAI(WorldEntity*); |
---|
| 15 | void getAttributesFrom(SwarmModule* oldModule); |
---|
| 16 | virtual void initialize(){} |
---|
| 17 | inline bool taskDone(){return taskComplete;} |
---|
[10349] | 18 | |
---|
| 19 | inline void setEnemyList(std::vector<WorldEntity*>* enemys){this->enemys=enemys;} |
---|
| 20 | |
---|
[10249] | 21 | inline void newOrder(){this->taskComplete=false;} |
---|
[10244] | 22 | inline void orderRelPos(Vector taskRelPos){this->taskRelPos=taskRelPos;} |
---|
| 23 | inline void orderAbsPos(Vector taskAbsPos){this->taskAbsPos=taskAbsPos;} |
---|
| 24 | inline void orderView(Vector taskView){this->taskView=taskView;} |
---|
| 25 | inline void orderSpeed(float taskSpeed){this->taskSpeed=taskSpeed;} |
---|
| 26 | inline void orderRelObject(WorldEntity* taskRelObject){this->taskRelObject=taskRelObject;} |
---|
| 27 | inline void orderMaxTime(float taskMaxTime){this->taskMaxTime=taskMaxTime;} |
---|
| 28 | |
---|
[10249] | 29 | Vector getSwarmPosition(); |
---|
| 30 | inline Vector getPosition(){return position;} |
---|
[10244] | 31 | inline float getSpeed(){return speed;} |
---|
| 32 | inline Vector getView(){return view;} |
---|
| 33 | inline int getSwarmSize(){return members.size();} |
---|
| 34 | inline std::vector<WorldEntity*>* getEnemyList(){return enemys;} |
---|
| 35 | inline std::map<WorldEntity*,AIModule*> getMembers(){return members;} |
---|
[10349] | 36 | inline float getMaxSpeed(){return maxSpeed;} |
---|
| 37 | inline float getAttackDistance(){return attackDistance;} |
---|
| 38 | |
---|
[10244] | 39 | protected: |
---|
| 40 | float getRadius(WorldEntity* object); |
---|
| 41 | void changeAIModule(std::map<WorldEntity*,AIModule*>::iterator it,AIModule* newAI); |
---|
| 42 | Vector taskRelPos; |
---|
| 43 | Vector taskAbsPos; |
---|
| 44 | Vector taskView; |
---|
| 45 | float taskSpeed; |
---|
| 46 | WorldEntity* taskRelObject; |
---|
| 47 | bool taskComplete; |
---|
| 48 | float taskMaxTime; |
---|
[10349] | 49 | |
---|
[10244] | 50 | Vector view; |
---|
[10249] | 51 | Vector position; |
---|
[10244] | 52 | float speed; |
---|
[10349] | 53 | |
---|
| 54 | float maxSpeed; |
---|
| 55 | float attackDistance; |
---|
| 56 | |
---|
| 57 | std::map<WorldEntity*,AIModule*> members; |
---|
[10244] | 58 | std::vector<WorldEntity*>* enemys; |
---|
| 59 | }; |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | #endif /* _SWARM_MODULE_H */ |
---|