[10663] | 1 | /* |
---|
| 2 | * file groundTurret.h |
---|
| 3 | * A weapon that is fix located, and automatically shooting at a target. |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _ADM_TURRET_H |
---|
| 7 | #define _ADM_TURRET_H |
---|
| 8 | |
---|
| 9 | //#include "sound_buffer.h" |
---|
| 10 | //#include "sound_source.h" |
---|
| 11 | |
---|
[10664] | 12 | #include "world_entity.h" |
---|
[10689] | 13 | #include "weapons/bsp_weapon.h" |
---|
[10663] | 14 | |
---|
[10708] | 15 | class DamageForwardingWorldEntity: public WorldEntity |
---|
| 16 | { |
---|
| 17 | public: |
---|
| 18 | DamageForwardingWorldEntity( WorldEntity* dfp ){ this->damPar = dfp; } |
---|
| 19 | virtual void hit(float damage, WorldEntity* killer){ this->damPar->hit(damage, killer); } |
---|
| 20 | private: |
---|
| 21 | WorldEntity* damPar; |
---|
| 22 | }; |
---|
[10703] | 23 | |
---|
[10708] | 24 | |
---|
[10664] | 25 | class AdmTurret : public WorldEntity |
---|
[10663] | 26 | { |
---|
| 27 | ObjectListDeclaration(AdmTurret); |
---|
| 28 | public: |
---|
| 29 | AdmTurret (); |
---|
| 30 | AdmTurret (const TiXmlElement* root); |
---|
| 31 | virtual ~AdmTurret(); |
---|
| 32 | |
---|
| 33 | void init(); |
---|
| 34 | void loadParams(const TiXmlElement* root); |
---|
| 35 | |
---|
| 36 | virtual void tick(float dt); |
---|
| 37 | virtual void draw() const; |
---|
| 38 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
---|
| 39 | |
---|
| 40 | virtual void activate(); |
---|
| 41 | virtual void deactivate(); |
---|
| 42 | |
---|
| 43 | virtual void setTarget(const std::string& target); |
---|
| 44 | |
---|
[10703] | 45 | virtual void destroy(WorldEntity* killer); |
---|
| 46 | |
---|
[10663] | 47 | private: |
---|
[10677] | 48 | WorldEntity* cannons; |
---|
| 49 | WorldEntity* sensor; |
---|
[10663] | 50 | WorldEntity* myTarget; |
---|
[10677] | 51 | |
---|
| 52 | void addCannons(const TiXmlElement* root); |
---|
| 53 | void addSensor(const TiXmlElement* root); |
---|
[10694] | 54 | void addWeapon(const TiXmlElement* root); |
---|
[10677] | 55 | |
---|
| 56 | void moveTowards( Vector targetDir, float dt ); |
---|
[10681] | 57 | |
---|
| 58 | float bodyAngle; |
---|
| 59 | float cannonAngle; |
---|
| 60 | |
---|
| 61 | bool isActive; |
---|
| 62 | float range; |
---|
| 63 | |
---|
| 64 | bool isCeil; |
---|
| 65 | void setType( const std::string& type ); |
---|
[10688] | 66 | |
---|
| 67 | bool playerVisible; |
---|
| 68 | void updatePlayerVisible(); |
---|
[10689] | 69 | |
---|
| 70 | BspWeapon* weapon; |
---|
[10664] | 71 | }; |
---|
| 72 | |
---|
| 73 | #endif |
---|
[10694] | 74 | |
---|