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 | * Fabian 'x3n' Landau |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _Engine_H__ |
---|
30 | #define _Engine_H__ |
---|
31 | |
---|
32 | #include "OrxonoxPrereqs.h" |
---|
33 | |
---|
34 | #include "tools/interfaces/Tickable.h" |
---|
35 | #include "Item.h" |
---|
36 | |
---|
37 | #include "interfaces/PickupCarrier.h" |
---|
38 | |
---|
39 | namespace orxonox |
---|
40 | { |
---|
41 | class _OrxonoxExport Engine : public Item, public Tickable, public PickupCarrier |
---|
42 | { |
---|
43 | public: |
---|
44 | Engine(BaseObject* creator); |
---|
45 | virtual ~Engine(); |
---|
46 | |
---|
47 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
48 | void setConfigValues(); |
---|
49 | |
---|
50 | virtual void tick(float dt); |
---|
51 | virtual void changedActivity(); |
---|
52 | |
---|
53 | virtual void addToSpaceShip(SpaceShip* ship); |
---|
54 | inline SpaceShip* getShip() const |
---|
55 | { return this->ship_; } |
---|
56 | |
---|
57 | inline void setRelativePosition(const Vector3 &position) |
---|
58 | { this->relativePosition_ = position; } |
---|
59 | inline Vector3& getRelativePosition() |
---|
60 | { return this->relativePosition_; } |
---|
61 | |
---|
62 | inline void setBoostFactor(float factor) |
---|
63 | { this->boostFactor_ = factor; } |
---|
64 | inline float getBoostFactor() const |
---|
65 | { return this->boostFactor_; } |
---|
66 | |
---|
67 | inline void setSpeedFactor(float factor) |
---|
68 | { this->speedFactor_ = factor; } |
---|
69 | inline float getSpeedFactor() const |
---|
70 | { return this->speedFactor_; } |
---|
71 | |
---|
72 | inline void setMaxSpeedFront(float speed) |
---|
73 | { this->maxSpeedFront_ = speed; } |
---|
74 | inline void setMaxSpeedBack(float speed) |
---|
75 | { this->maxSpeedBack_ = speed; } |
---|
76 | inline void setMaxSpeedLeftRight(float speed) |
---|
77 | { this->maxSpeedLeftRight_ = speed; } |
---|
78 | inline void setMaxSpeedUpDown(float speed) |
---|
79 | { this->maxSpeedUpDown_ = speed; } |
---|
80 | |
---|
81 | inline float getMaxSpeedFront() const |
---|
82 | { return this->maxSpeedFront_; } |
---|
83 | inline float getMaxSpeedBack() const |
---|
84 | { return this->maxSpeedBack_; } |
---|
85 | inline float getMaxSpeedLeftRight() const |
---|
86 | { return this->maxSpeedLeftRight_; } |
---|
87 | inline float getMaxSpeedUpDown() const |
---|
88 | { return this->maxSpeedUpDown_; } |
---|
89 | |
---|
90 | inline void setAccelerationFront(float acceleration) |
---|
91 | { this->accelerationFront_ = acceleration; } |
---|
92 | inline void setAccelerationBrake(float acceleration) |
---|
93 | { this->accelerationBrake_ = acceleration; } |
---|
94 | inline void setAccelerationBack(float acceleration) |
---|
95 | { this->accelerationBack_ = acceleration; } |
---|
96 | inline void setAccelerationLeftRight(float acceleration) |
---|
97 | { this->accelerationLeftRight_ = acceleration; } |
---|
98 | inline void setAccelerationUpDown(float acceleration) |
---|
99 | { this->accelerationUpDown_ = acceleration; } |
---|
100 | |
---|
101 | inline float getAccelerationFront() const |
---|
102 | { return this->accelerationFront_; } |
---|
103 | inline float getAccelerationBrake() const |
---|
104 | { return this->accelerationBrake_; } |
---|
105 | inline float getAccelerationBack() const |
---|
106 | { return this->accelerationBack_; } |
---|
107 | inline float getAccelerationLeftRight() const |
---|
108 | { return this->accelerationLeftRight_; } |
---|
109 | inline float getAccelerationUpDown() const |
---|
110 | { return this->accelerationUpDown_; } |
---|
111 | |
---|
112 | inline float getSpeedAdd(void) |
---|
113 | { return this->speedAdd_; } |
---|
114 | inline float getSpeedMultiply(void) |
---|
115 | { return this->speedMultiply_; } |
---|
116 | |
---|
117 | virtual const Vector3& getDirection() const; |
---|
118 | |
---|
119 | virtual const Vector3& getCarrierPosition(void) const; |
---|
120 | |
---|
121 | inline void setSpeedAdd(float speedAdd) |
---|
122 | { this->speedAdd_=speedAdd; } |
---|
123 | inline void setSpeedMultiply(float speedMultiply) |
---|
124 | { this->speedMultiply_=speedMultiply; } |
---|
125 | |
---|
126 | |
---|
127 | inline void setEngineTemplate(const std::string& temp) |
---|
128 | { this->engineTemplate_ = temp; this->loadEngineTemplate(); } |
---|
129 | inline const std::string& getEngineTemplate() const |
---|
130 | { return this->engineTemplate_; } |
---|
131 | |
---|
132 | protected: |
---|
133 | virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const |
---|
134 | { return new std::vector<PickupCarrier*>(); } |
---|
135 | virtual PickupCarrier* getCarrierParent(void) const; |
---|
136 | |
---|
137 | void loadEngineTemplate(); |
---|
138 | |
---|
139 | private: |
---|
140 | void registerVariables(); |
---|
141 | void networkcallback_shipID(); |
---|
142 | |
---|
143 | std::string engineTemplate_; |
---|
144 | |
---|
145 | SpaceShip* ship_; |
---|
146 | unsigned int shipID_; |
---|
147 | Vector3 relativePosition_; |
---|
148 | |
---|
149 | float boostFactor_; |
---|
150 | float speedFactor_; |
---|
151 | |
---|
152 | float speedAdd_; |
---|
153 | float speedMultiply_; |
---|
154 | |
---|
155 | float maxSpeedFront_; |
---|
156 | float maxSpeedBack_; |
---|
157 | float maxSpeedLeftRight_; |
---|
158 | float maxSpeedUpDown_; |
---|
159 | |
---|
160 | float accelerationFront_; |
---|
161 | float accelerationBrake_; |
---|
162 | float accelerationBack_; |
---|
163 | float accelerationLeftRight_; |
---|
164 | float accelerationUpDown_; |
---|
165 | }; |
---|
166 | } |
---|
167 | |
---|
168 | #endif /* _Engine_H__ */ |
---|