Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/consolecommands/src/modules/weapons/projectiles/Rocket.h @ 6336

Last change on this file since 6336 was 6285, checked in by youngk, 15 years ago

Launching sound of the Rocket plays normally now. Changed AL_MAX_DISTANCE to 10000.

  • Property svn:eol-style set to native
File size: 4.7 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 _Rocket_H__
30#define _Rocket_H__
31
32#include "weapons/WeaponsPrereqs.h"
33#include "worldentities/ControllableEntity.h"
34
35namespace orxonox
36{
37    class ConeCollisionShape;
38
39    /**
40    @brief
41        Rocket, that is made to move upon a specified pattern.
42        This class was constructed for the PPS tutorial.
43    @author
44        Oli Scheuss
45    */
46    class _WeaponsExport Rocket : public ControllableEntity
47    {
48        public:
49            Rocket(BaseObject* creator);
50            virtual ~Rocket();
51
52            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Rocket through XML.
53            virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
54           
55            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
56            void destroyObject();
57           
58            virtual void moveFrontBack(const Vector2& value){}
59            virtual void moveRightLeft(const Vector2& value){}
60            virtual void moveUpDown(const Vector2& value){}
61
62            virtual void rotateYaw(const Vector2& value);
63            virtual void rotatePitch(const Vector2& value);
64            virtual void rotateRoll(const Vector2& value);
65           
66            /**
67            @brief Moves the Rocket in the Front/Back-direction by the specifed amount.
68            @param value  The amount by which the Rocket is to be moved.
69            */
70            inline void moveFrontBack(float value)
71            { this->moveFrontBack(Vector2(value, 0)); }
72            /**
73            @brief Moves the Rocket in the Right/Left-direction by the specifed amount.
74            @param value  The amount by which the Rocket is to be moved.
75            */
76            inline void moveRightLeft(float value)
77            { this->moveRightLeft(Vector2(value, 0)); }
78            /**
79            @brief Moves the Rocket in the Up/Down-direction by the specifed amount.
80            @param value  The amount by which the Rocket is to be moved.
81            */
82            inline void moveUpDown(float value)
83            { this->moveUpDown(Vector2(value, 0)); }
84           
85            /**
86            @brief Rotates the Rocket around the y-axis by the specifed amount.
87            @param value  The amount by which the Rocket is to be rotated.
88            */
89            inline void rotateYaw(float value)
90            { this->rotateYaw(Vector2(value, 0)); }
91            /**
92            @brief Rotates the Rocket around the x-axis by the specifed amount.
93            @param value  The amount by which the Rocket is to be rotated.
94            */
95            inline void rotatePitch(float value)
96            { this->rotatePitch(Vector2(value, 0)); }
97            /**
98            @brief Rotates the Rocket around the z-axis by the specifed amount.
99            @param value  The amount by which the Rocket is to be rotated.
100            */
101            inline void rotateRoll(float value)
102            { this->rotateRoll(Vector2(value, 0)); }
103           
104            void setOwner(Pawn* owner);
105            inline Pawn* getOwner() const
106                { return this->owner_; }
107               
108            inline void setDamage(float damage)
109                { this->damage_ = damage; }
110            inline float getDamage() const
111                { return this->damage_; }
112            virtual void fired(unsigned int firemode);
113           
114        private:
115            WeakPtr<Pawn> owner_;
116            Vector3 localAngularVelocity_;
117            float damage_;
118            bool bDestroy_;
119            ControllableEntity* originalControllableEntity_;
120           
121            WeakPtr<PlayerInfo> player_;
122            Timer destroyTimer_;
123            float lifetime_;
124
125            WorldSound* defSndWpnEngine_;
126            WorldSound* defSndWpnLaunch_;
127    };
128
129}
130
131#endif /* _Rocket_H__ */
Note: See TracBrowser for help on using the repository browser.