Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/weapons/projectiles/SimpleRocket.h @ 7163

Last change on this file since 7163 was 7163, checked in by dafrick, 14 years ago

Merged presentation3 branch into trunk.

  • Property svn:eol-style set to native
File size: 5.0 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 *      Oliver Scheuss
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _SimpleRocket_H__
30#define _SimpleRocket_H__
31
32#include "weapons/WeaponsPrereqs.h"
33
34#include "tools/Timer.h"
35#include "worldentities/ControllableEntity.h"
36#include "graphics/ParticleSpawner.h"
37
38namespace orxonox
39{
40    class ConeCollisionShape;
41
42    /**
43    @brief
44        SimpleRocket, follows direction from a Rocketcontroller, has fuel for 80% of its lifetime, afterwards it's fire disappears.
45    @author
46       Gabriel Nadler (Original file: Oli Scheuss)
47    */
48    class _WeaponsExport SimpleRocket : public ControllableEntity
49    {
50        public:
51            SimpleRocket(BaseObject* creator);
52            virtual ~SimpleRocket();
53            virtual void tick(float dt);
54            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleRocket through XML.
55
56            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
57            void destroyObject();
58
59            void disableFire(); //!< Method to disable the fire and stop all acceleration
60
61            virtual void moveFrontBack(const Vector2& value){}
62            virtual void moveRightLeft(const Vector2& value){}
63            virtual void moveUpDown(const Vector2& value){}
64
65            virtual void rotateYaw(const Vector2& value);
66            virtual void rotatePitch(const Vector2& value);
67            virtual void rotateRoll(const Vector2& value);
68            void setDestroy();
69
70            /**
71            @brief Moves the SimpleRocket in the Front/Back-direction by the specifed amount.
72            @param value  The amount by which the SimpleRocket is to be moved.
73            */
74            inline void moveFrontBack(float value)
75            { this->moveFrontBack(Vector2(value, 0)); }
76            /**
77            @brief Moves the SimpleRocket in the Right/Left-direction by the specifed amount.
78            @param value  The amount by which the SimpleRocket is to be moved.
79            */
80            inline void moveRightLeft(float value)
81            { this->moveRightLeft(Vector2(value, 0)); }
82            /**
83            @brief Moves the SimpleRocket in the Up/Down-direction by the specifed amount.
84            @param value  The amount by which the SimpleRocket is to be moved.
85            */
86            inline void moveUpDown(float value)
87            { this->moveUpDown(Vector2(value, 0)); }
88
89            /**
90            @brief Rotates the SimpleRocket around the y-axis by the specifed amount.
91            @param value  The amount by which the SimpleRocket is to be rotated.
92            */
93            inline void rotateYaw(float value)
94            { this->rotateYaw(Vector2(value, 0)); }
95            /**
96            @brief Rotates the SimpleRocket around the x-axis by the specifed amount.
97            @param value  The amount by which the SimpleRocket is to be rotated.
98            */
99            inline void rotatePitch(float value)
100            {
101                this->rotatePitch(Vector2(value, 0)); }
102            /**
103            @brief Rotates the SimpleRocket around the z-axis by the specifed amount.
104            @param value  The amount by which the SimpleRocket is to be rotated.
105            */
106            inline void rotateRoll(float value)
107            {
108                this->rotateRoll(Vector2(value, 0)); }
109
110            void setOwner(Pawn* owner);
111            inline Pawn* getOwner() const
112                { return this->owner_; }
113            inline bool hasFuel() const
114            { return this->fuel_; }
115
116            inline void setDamage(float damage)
117                { this->damage_ = damage; }
118            inline float getDamage() const
119                { return this->damage_; }
120
121
122        private:
123            WeakPtr<Pawn> owner_;
124            Vector3 localAngularVelocity_;
125            float damage_;
126            bool bDestroy_;
127            bool fuel_; //!< Bool is true while the rocket "has fuel"
128
129
130            WeakPtr<PlayerInfo> player_;
131            Timer destroyTimer_;
132            float lifetime_;
133            static const int FUEL_PERCENTAGE=80; //!<Percentage of Lifetime the rocket has fuel
134
135            ParticleEmitter* fire_; //!< Fire-Emittor
136
137
138
139    };
140
141}
142
143#endif /* _SimpleRocket_H__ */
Note: See TracBrowser for help on using the repository browser.