| 1 | |
|---|
| 2 | #ifndef _AI_MODULE_H |
|---|
| 3 | #define _AI_MODULE_H |
|---|
| 4 | #include "world_entity.h" |
|---|
| 5 | class NPC2; |
|---|
| 6 | |
|---|
| 7 | class AIModule { |
|---|
| 8 | public: |
|---|
| 9 | inline AIModule(){taskComplete=false;} |
|---|
| 10 | virtual ~AIModule(){} |
|---|
| 11 | virtual void process(float dt){} |
|---|
| 12 | |
|---|
| 13 | inline void setDestination(Vector destination){this->destination=destination;} |
|---|
| 14 | inline void setDestinationMovement(Vector destinationMovement){this->destinationMovement=destinationMovement;} |
|---|
| 15 | inline void setWeight(int weight){this->weight=weight;} |
|---|
| 16 | inline void setTarget(WorldEntity* target){this->target=target;} |
|---|
| 17 | inline void setNPC(WorldEntity* npc){this->npc=npc;} |
|---|
| 18 | inline void setMaxSpeed(float maxSpeed){this->maxSpeed=maxSpeed;} |
|---|
| 19 | inline void setAttackDistance(float attackDistance){this->attackDistance=attackDistance;} |
|---|
| 20 | |
|---|
| 21 | inline Vector getPosition(){return npc->getAbsCoor();} |
|---|
| 22 | inline Vector getMovement(){return movement;} |
|---|
| 23 | inline Vector getView(){return view;} |
|---|
| 24 | inline WorldEntity* getNPC(){return npc;} |
|---|
| 25 | inline WorldEntity* getTarget(){return target;} |
|---|
| 26 | inline float getWeight(){return weight;} |
|---|
| 27 | inline float getMaxAcceleration(){return accelerationMax;} |
|---|
| 28 | inline float getMaxSpeed(){return maxSpeed;} |
|---|
| 29 | inline float getAttackDistance(){return attackDistance;} |
|---|
| 30 | inline float getNPCRadius(){return getRadius(npc);} |
|---|
| 31 | |
|---|
| 32 | inline bool done(){return taskComplete;} |
|---|
| 33 | |
|---|
| 34 | void getAttributesFrom(AIModule* oldModule); |
|---|
| 35 | |
|---|
| 36 | protected: |
|---|
| 37 | float getRadius(WorldEntity* object); |
|---|
| 38 | |
|---|
| 39 | Vector destination; |
|---|
| 40 | Vector destinationMovement; |
|---|
| 41 | Vector destinationView; |
|---|
| 42 | |
|---|
| 43 | bool taskComplete; |
|---|
| 44 | Vector movement; |
|---|
| 45 | Vector view; |
|---|
| 46 | |
|---|
| 47 | WorldEntity* npc; |
|---|
| 48 | WorldEntity* target; |
|---|
| 49 | |
|---|
| 50 | float weight; |
|---|
| 51 | float maxSpeed; |
|---|
| 52 | float attackDistance; |
|---|
| 53 | float accelerationMax; |
|---|
| 54 | }; |
|---|
| 55 | |
|---|
| 56 | #endif /* _AI_MODULE_H */ |
|---|