| Line | |
|---|
| 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 | |
|---|
| 12 | #include "world_entity.h" |
|---|
| 13 | #include "weapons/bsp_weapon.h" |
|---|
| 14 | |
|---|
| 15 | class AdmTurret : public WorldEntity |
|---|
| 16 | { |
|---|
| 17 | ObjectListDeclaration(AdmTurret); |
|---|
| 18 | public: |
|---|
| 19 | AdmTurret (); |
|---|
| 20 | AdmTurret (const TiXmlElement* root); |
|---|
| 21 | virtual ~AdmTurret(); |
|---|
| 22 | |
|---|
| 23 | void init(); |
|---|
| 24 | void loadParams(const TiXmlElement* root); |
|---|
| 25 | |
|---|
| 26 | virtual void tick(float dt); |
|---|
| 27 | virtual void draw() const; |
|---|
| 28 | virtual void collidesWith(WorldEntity* entity, const Vector& location); |
|---|
| 29 | |
|---|
| 30 | virtual void activate(); |
|---|
| 31 | virtual void deactivate(); |
|---|
| 32 | |
|---|
| 33 | virtual void setTarget(const std::string& target); |
|---|
| 34 | |
|---|
| 35 | private: |
|---|
| 36 | WorldEntity* cannons; |
|---|
| 37 | WorldEntity* sensor; |
|---|
| 38 | WorldEntity* myTarget; |
|---|
| 39 | void fire(); |
|---|
| 40 | |
|---|
| 41 | void addCannons(const TiXmlElement* root); |
|---|
| 42 | void addSensor(const TiXmlElement* root); |
|---|
| 43 | |
|---|
| 44 | void moveTowards( Vector targetDir, float dt ); |
|---|
| 45 | |
|---|
| 46 | float bodyAngle; |
|---|
| 47 | float cannonAngle; |
|---|
| 48 | |
|---|
| 49 | bool isActive; |
|---|
| 50 | float range; |
|---|
| 51 | |
|---|
| 52 | bool isCeil; |
|---|
| 53 | void setType( const std::string& type ); |
|---|
| 54 | |
|---|
| 55 | bool bFire; |
|---|
| 56 | bool playerVisible; |
|---|
| 57 | void updatePlayerVisible(); |
|---|
| 58 | |
|---|
| 59 | BspWeapon* weapon; |
|---|
| 60 | }; |
|---|
| 61 | |
|---|
| 62 | #endif |
|---|
Note: See
TracBrowser
for help on using the repository browser.