Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/objecthierarchy2/src/orxonox/objects/items/Engine.h @ 2254

Last change on this file since 2254 was 2254, checked in by landauf, 15 years ago

Update your media repository and delete keybindings.ini if you want to use boost (space).

  • Added new class "Engine" to control the speed of a SpaceShip (Engine is an Item, MultiStateEngine is a specialized version of Engine)
  • Added FadingBillboard, a billboard with the ability to fade in and out smoothly when activated/deactivated.
  • Several changes in Backlight, it's now a child of FadingBillboard
  • Some changes concerning local control in ControllableEntity
  • Fixed a bug in WorldEntity caused by different destruction order of attached objects on server and client
  • Added a "MainState" to BaseObject. An object has several states (activity, visibility, …) and one of it can be defined as "MainState" in the XML file. Other objects can change this state without knowing which state it really is (used by MultiStateEngine).
  • Property svn:eol-style set to native
File size: 3.6 KB
Line 
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 "Item.h"
35#include "objects/Tickable.h"
36#include "util/Math.h"
37
38namespace orxonox
39{
40    class _OrxonoxExport Engine : public Item, public Tickable
41    {
42        public:
43            Engine(BaseObject* creator);
44            virtual ~Engine();
45
46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
47            void registerVariables();
48
49            virtual void tick(float dt);
50
51            virtual void addToSpaceShip(SpaceShip* ship);
52            inline SpaceShip* getShip() const
53                { return this->ship_; }
54
55            inline void setBoostFactor(float factor)
56                { this->boostFactor_ = factor; }
57            inline float getBoostFactor() const
58                { return this->boostFactor_; }
59
60            inline void setSpeedFactor(float factor)
61                { this->speedFactor_ = factor; }
62            inline float getSpeedFactor() const
63                { return this->speedFactor_; }
64
65            inline void setMaxSpeedFront(float speed)
66                { this->maxSpeedFront_ = speed; }
67            inline void setMaxSpeedBack(float speed)
68                { this->maxSpeedBack_ = speed; }
69            inline void setMaxSpeedLeftRight(float speed)
70                { this->maxSpeedLeftRight_ = speed; }
71            inline void setMaxSpeedUpDown(float speed)
72                { this->maxSpeedUpDown_ = speed; }
73
74            inline void setAccelerationFront(float acceleration)
75                { this->accelerationFront_ = acceleration; }
76            inline void setAccelerationBrake(float acceleration)
77                { this->accelerationBrake_ = acceleration; }
78            inline void setAccelerationBack(float acceleration)
79                { this->accelerationBack_ = acceleration; }
80            inline void setAccelerationLeftRight(float acceleration)
81                { this->accelerationLeftRight_ = acceleration; }
82            inline void setAccelerationUpDown(float acceleration)
83                { this->accelerationUpDown_ = acceleration; }
84
85            virtual const Vector3& getDirection() const;
86
87        private:
88            void networkcallback_shipID();
89
90            SpaceShip* ship_;
91            unsigned int shipID_;
92
93            float boostFactor_;
94            float speedFactor_;
95
96            float maxSpeedFront_;
97            float maxSpeedBack_;
98            float maxSpeedLeftRight_;
99            float maxSpeedUpDown_;
100
101            float accelerationFront_;
102            float accelerationBrake_;
103            float accelerationBack_;
104            float accelerationLeftRight_;
105            float accelerationUpDown_;
106    };
107}
108
109#endif /* _Engine_H__ */
Note: See TracBrowser for help on using the repository browser.