[10447] | 1 | |
---|
| 2 | #ifndef _NPC_H |
---|
| 3 | #define _NPC_H |
---|
| 4 | |
---|
| 5 | #include "world_entity.h" |
---|
| 6 | #include "ai_module.h" |
---|
| 7 | #include "world_entities/weapons/weapon_manager.h" |
---|
| 8 | |
---|
| 9 | class AI; |
---|
| 10 | |
---|
| 11 | class NPC : public WorldEntity |
---|
| 12 | { |
---|
| 13 | ObjectListDeclaration(NPC); |
---|
| 14 | |
---|
| 15 | public: |
---|
| 16 | NPC(const TiXmlElement* root = NULL); |
---|
| 17 | virtual ~NPC (); |
---|
| 18 | |
---|
| 19 | virtual void loadParams(const TiXmlElement* root); |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | void addWeapons(const TiXmlElement* root); |
---|
| 23 | bool addWeapon(Weapon* weapon, int configID = -1, int slotID = -1); |
---|
| 24 | void removeWeapon(Weapon* weapon); |
---|
| 25 | void nextWeaponConfig(); |
---|
| 26 | void previousWeaponConfig(); |
---|
| 27 | inline WeaponManager& getWeaponManager() { return this->weaponMan; }; |
---|
[10499] | 28 | void setWeaponConfig(int i); |
---|
[10447] | 29 | |
---|
| 30 | |
---|
| 31 | virtual void tick(float dt); |
---|
| 32 | void draw() const; |
---|
| 33 | inline int getTeam() { return teamNumber; } |
---|
| 34 | inline void fire(){ this->bFire=true;} |
---|
[10512] | 35 | void setAI(bool activate); |
---|
[10499] | 36 | inline void enableAI(int flag) { this->bAIEnabled = (bool)flag; } |
---|
[10545] | 37 | void destroy( WorldEntity* killer ); |
---|
[10447] | 38 | |
---|
[10539] | 39 | void hit( float damage, WorldEntity* killer); |
---|
| 40 | |
---|
[10545] | 41 | inline void destroyThis() { this->destroy(NULL);}; |
---|
| 42 | |
---|
[10447] | 43 | private: |
---|
| 44 | inline void setTeamNumber(int number) { teamNumber=number; } |
---|
| 45 | inline void setSwarmNumber(int number) { swarmNumber=number; } |
---|
| 46 | inline void setMaxSpeed(float number) { maxSpeed=number; } |
---|
| 47 | inline void setAttackDistance(float number) { attackDistance=number; } |
---|
| 48 | |
---|
| 49 | private: |
---|
| 50 | |
---|
| 51 | int teamNumber; //!< number of the team |
---|
| 52 | int swarmNumber; //!< number of the swarm |
---|
| 53 | int difficulty; //!< difficulty |
---|
| 54 | float maxSpeed; |
---|
| 55 | float attackDistance; |
---|
| 56 | |
---|
| 57 | WeaponManager weaponMan; //!< weapon manager |
---|
| 58 | bool bFire; //!< fire |
---|
[10546] | 59 | bool bInit; |
---|
[10447] | 60 | |
---|
| 61 | AIModule* aiModule; |
---|
| 62 | |
---|
| 63 | bool bAIEnabled; //!< true is AI enabled |
---|
| 64 | }; |
---|
| 65 | |
---|
| 66 | #endif /* _NPC_H */ |
---|