Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/bigships/src/orxonox/items/Engine.h @ 8426

Last change on this file since 8426 was 8426, checked in by decryphe, 13 years ago
  • Moved handling of blur effect from Engine.cc to SpaceShip.cc.
  • Implemented handling of multiple engines per SpaceShip, so that in future it would be possible to turn single engines on/off individually (for example if one gets destroyed on a big ship).
  • Updated some pointers accessing the single Engine of a SpaceShip to ask the SpaceShip itself instead for data.
  • Property svn:eol-style set to native
File size: 5.9 KB
RevLine 
[2254]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
[5693]34#include "tools/interfaces/Tickable.h"
[2254]35#include "Item.h"
36
[6709]37#include "interfaces/PickupCarrier.h"
38
[2254]39namespace orxonox
40{
[6709]41    class _OrxonoxExport Engine : public Item, public Tickable, public PickupCarrier
[2254]42    {
43        public:
44            Engine(BaseObject* creator);
45            virtual ~Engine();
46
47            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
[2478]48            void setConfigValues();
[2254]49
50            virtual void tick(float dt);
[2350]51            virtual void changedActivity();
[2254]52
53            virtual void addToSpaceShip(SpaceShip* ship);
54            inline SpaceShip* getShip() const
55                { return this->ship_; }
56
[8426]57                        inline void setRelativePosition(const Vector3 &position)
58                                { this->relativePosition_ = position; }
59                        inline Vector3& getRelativePosition()
60                                { return this->relativePosition_; }
61
[2254]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
[2256]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
[2254]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
[2256]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
[6709]112            inline float getSpeedAdd(void)
113                { return this->speedAdd_; }
114            inline float getSpeedMultiply(void)
115                { return this->speedMultiply_; }
116
[2254]117            virtual const Vector3& getDirection() const;
118
[7547]119            virtual const Vector3& getCarrierPosition(void) const;
[6709]120
121            inline void setSpeedAdd(float speedAdd)
122                { this->speedAdd_=speedAdd; }
123            inline void setSpeedMultiply(float speedMultiply)
124                { this->speedMultiply_=speedMultiply; }
125
[8426]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
[6709]132        protected:
[7547]133            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
[6711]134                { return new std::vector<PickupCarrier*>(); }
[7547]135            virtual PickupCarrier* getCarrierParent(void) const;
[8426]136                       
137            void loadEngineTemplate();
[6709]138
[2254]139        private:
[7163]140            void registerVariables();
[2254]141            void networkcallback_shipID();
142
[8426]143                        std::string engineTemplate_;
144
[2254]145            SpaceShip* ship_;
146            unsigned int shipID_;
[8426]147                        Vector3 relativePosition_;
[2254]148
149            float boostFactor_;
150            float speedFactor_;
151
[6709]152            float speedAdd_;
153            float speedMultiply_;
154
[2254]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__ */
Note: See TracBrowser for help on using the repository browser.