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 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 | }; |
---|
23 | |
---|
24 | |
---|
25 | class AdmTurret : public WorldEntity |
---|
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 | |
---|
45 | virtual void destroy(WorldEntity* killer); |
---|
46 | |
---|
47 | private: |
---|
48 | WorldEntity* cannons; |
---|
49 | WorldEntity* sensor; |
---|
50 | WorldEntity* myTarget; |
---|
51 | |
---|
52 | void addCannons(const TiXmlElement* root); |
---|
53 | void addSensor(const TiXmlElement* root); |
---|
54 | void addWeapon(const TiXmlElement* root); |
---|
55 | |
---|
56 | void moveTowards( Vector targetDir, float dt ); |
---|
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 ); |
---|
66 | |
---|
67 | bool playerVisible; |
---|
68 | void updatePlayerVisible(); |
---|
69 | |
---|
70 | BspWeapon* weapon; |
---|
71 | }; |
---|
72 | |
---|
73 | #endif |
---|
74 | |
---|