1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Marian Runo |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | /** |
---|
30 | @file Turret.h |
---|
31 | @brief Definition of the Turret class. |
---|
32 | @ingroup Objects |
---|
33 | */ |
---|
34 | |
---|
35 | #ifndef _Turret_H__ |
---|
36 | #define _Turret_H__ |
---|
37 | |
---|
38 | #include "objects/ObjectsPrereqs.h" |
---|
39 | #include "worldentities/pawns/Pawn.h" |
---|
40 | |
---|
41 | namespace orxonox |
---|
42 | { |
---|
43 | class _ObjectsExport Turret : public Pawn |
---|
44 | { |
---|
45 | public: |
---|
46 | Turret(Context* context); |
---|
47 | virtual ~Turret(); |
---|
48 | |
---|
49 | virtual void rotatePitch(const Vector2& value); |
---|
50 | virtual void rotateYaw(const Vector2& value); |
---|
51 | virtual void rotateRoll(const Vector2& value); |
---|
52 | virtual bool isInRange(const Vector3 &position); |
---|
53 | virtual void aimAtPosition(const Vector3 &position); |
---|
54 | |
---|
55 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
56 | virtual void tick(float dt); |
---|
57 | |
---|
58 | inline void setAttackRadius(float radius) |
---|
59 | { this->attackRadius_ = radius; } |
---|
60 | |
---|
61 | inline void setMaxPitch(float pitch) |
---|
62 | { this->maxPitch_ = pitch; } |
---|
63 | |
---|
64 | inline void setMaxYaw(float yaw) |
---|
65 | { this->maxYaw_ = yaw; } |
---|
66 | |
---|
67 | inline float getAttackRadius() const |
---|
68 | { return this->attackRadius_; } |
---|
69 | |
---|
70 | inline float getMaxPitch() const |
---|
71 | { return this->maxPitch_; } |
---|
72 | |
---|
73 | inline float getMaxYaw() const |
---|
74 | { return this->maxYaw_; } |
---|
75 | |
---|
76 | protected: |
---|
77 | Vector3 startDir_; |
---|
78 | Vector3 localZ_; |
---|
79 | Vector3 localZStart_; |
---|
80 | Vector3 localY_; |
---|
81 | Vector3 localYStart_; |
---|
82 | Vector3 localX_; |
---|
83 | Vector3 localXStart_; |
---|
84 | |
---|
85 | private: |
---|
86 | bool once_; |
---|
87 | |
---|
88 | float attackRadius_; |
---|
89 | Ogre::Real maxPitch_; |
---|
90 | Ogre::Real maxYaw_; |
---|
91 | float rotationThrust_; |
---|
92 | |
---|
93 | Quaternion rotation_; |
---|
94 | }; |
---|
95 | } |
---|
96 | |
---|
97 | #endif |
---|