Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.h @ 7021

Last change on this file since 7021 was 7021, checked in by gnadler, 14 years ago

documentation & formatting commit

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