Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/modularships/src/modules/weapons/projectiles/Rocket.h @ 9995

Last change on this file since 9995 was 9995, checked in by noep, 11 years ago

Modified collision-detecting-process, such that collisions can be traced back to single child-CollisionShapes of Compound-CollisionShapes

  • Property svn:eol-style set to native
File size: 4.8 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 *      simonmie
26 *
27 */
28
29/**
30    @file Rocket.h
31    @brief Definition of the Rocket class.
32*/
33
34#ifndef _Rocket_H__
35#define _Rocket_H__
36
37#include "weapons/WeaponsPrereqs.h"
38
39#include "tools/Timer.h"
40
41#include "interfaces/RadarViewable.h"
42#include "worldentities/ControllableEntity.h"
43
44#include "BasicProjectile.h"
45
46namespace orxonox
47{
48    class ConeCollisionShape;
49
50    /**
51    @brief
52        Rocket that can be steered by the player.
53
54    @author
55        Oli Scheuss
56    @ingroup WeaponsProjectiles
57    */
58    class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile, public RadarViewable
59    {
60        public:
61            Rocket(Context* context);
62            virtual ~Rocket();
63
64            virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
65
66            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
67            virtual bool customCollidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
68            virtual void destroyObject(void);
69            void destructionEffect();
70
71            virtual void moveFrontBack(const Vector2& value) {}
72            virtual void moveRightLeft(const Vector2& value) {}
73            virtual void moveUpDown(const Vector2& value) {}
74
75            virtual void rotateYaw(const Vector2& value);
76            virtual void rotatePitch(const Vector2& value);
77            virtual void rotateRoll(const Vector2& value);
78
79            /**
80            @brief Moves the Rocket in the Front/Back-direction by the specifed amount.
81            @param value  The amount by which the Rocket is to be moved.
82            */
83            inline void moveFrontBack(float value)
84                { this->moveFrontBack(Vector2(value, 0)); }
85            /**
86            @brief Moves the Rocket in the Right/Left-direction by the specifed amount.
87            @param value  The amount by which the Rocket is to be moved.
88            */
89            inline void moveRightLeft(float value)
90                { this->moveRightLeft(Vector2(value, 0)); }
91            /**
92            @brief Moves the Rocket in the Up/Down-direction by the specifed amount.
93            @param value  The amount by which the Rocket is to be moved.
94            */
95            inline void moveUpDown(float value)
96                { this->moveUpDown(Vector2(value, 0)); }
97
98            /**
99            @brief Rotates the Rocket around the y-axis by the specifed amount.
100            @param value  The amount by which the Rocket is to be rotated.
101            */
102            inline void rotateYaw(float value)
103                { this->rotateYaw(Vector2(value, 0)); }
104            /**
105            @brief Rotates the Rocket around the x-axis by the specifed amount.
106            @param value  The amount by which the Rocket is to be rotated.
107            */
108            inline void rotatePitch(float value)
109                { this->rotatePitch(Vector2(value, 0)); }
110            /**
111            @brief Rotates the Rocket around the z-axis by the specifed amount.
112            @param value  The amount by which the Rocket is to be rotated.
113            */
114            inline void rotateRoll(float value)
115                { this->rotateRoll(Vector2(value, 0)); }
116
117            virtual void setShooter(Pawn* shooter);
118
119            virtual void fired(unsigned int firemode);
120
121        private:
122            Vector3 localAngularVelocity_; //!< Variable to temporarily store accumulated steering command input.
123
124            WeakPtr<PlayerInfo> player_; //!< The player that controls the Rocket.
125            //WeakPtr<Pawn> pawn_; //!< The pawn that controls the Rocket. TODO
126            Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out.
127            float lifetime_; //!< The time the projectile exists.
128
129            WorldSound* defSndWpnEngine_; //!< Engine sound.
130            WorldSound* defSndWpnLaunch_; //!< Launch sound.
131    };
132
133}
134
135#endif /* _Rocket_H__ */
Note: See TracBrowser for help on using the repository browser.