Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10043 was 9667, checked in by landauf, 11 years ago

merged core6 back to trunk

  • Property svn:eol-style set to native
File size: 5.0 KB
RevLine 
[7129]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:
[8855]23 *      Gabriel Nadler
[7129]24 *   Co-authors:
[8706]25 *      simonmie
[7129]26 *
27 */
28
[8855]29/**
30    @file SimpleRocket.h
31    @brief Definition of the SimpleRocket class.
32*/
33
[7129]34#ifndef _SimpleRocket_H__
35#define _SimpleRocket_H__
36
37#include "weapons/WeaponsPrereqs.h"
38
39#include "tools/Timer.h"
[8855]40
[7129]41#include "graphics/ParticleSpawner.h"
[8738]42#include "interfaces/RadarViewable.h"
[8855]43#include "worldentities/ControllableEntity.h"
[7129]44
[8706]45#include "BasicProjectile.h"
46
[7129]47namespace orxonox
48{
49    class ConeCollisionShape;
50
51    /**
52    @brief
[8855]53        SimpleRocket is a target seeking, intelligent rocket. It follows its target until it either hits something or runs out of fuel.
54        The steering is done by the RocketController.
[7129]55    @author
[8855]56       Gabriel Nadler
57    @ingroup WeaponsProjectiles
[7129]58    */
[8738]59    class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile, public RadarViewable
[7129]60    {
61        public:
[9667]62            SimpleRocket(Context* context);
[7129]63            virtual ~SimpleRocket();
64            virtual void tick(float dt);
65
66            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
67
68            void disableFire(); //!< Method to disable the fire and stop all acceleration
69
70            virtual void moveFrontBack(const Vector2& value){}
71            virtual void moveRightLeft(const Vector2& value){}
72            virtual void moveUpDown(const Vector2& value){}
73
74            virtual void rotateYaw(const Vector2& value);
75            virtual void rotatePitch(const Vector2& value);
76            virtual void rotateRoll(const Vector2& value);
77            void setDestroy();
78
79            /**
80            @brief Moves the SimpleRocket in the Front/Back-direction by the specifed amount.
81            @param value  The amount by which the SimpleRocket is to be moved.
82            */
83            inline void moveFrontBack(float value)
[8855]84                { this->moveFrontBack(Vector2(value, 0)); }
[7129]85            /**
86            @brief Moves the SimpleRocket in the Right/Left-direction by the specifed amount.
87            @param value  The amount by which the SimpleRocket is to be moved.
88            */
89            inline void moveRightLeft(float value)
[8855]90                { this->moveRightLeft(Vector2(value, 0)); }
[7129]91            /**
92            @brief Moves the SimpleRocket in the Up/Down-direction by the specifed amount.
93            @param value  The amount by which the SimpleRocket is to be moved.
94            */
95            inline void moveUpDown(float value)
[8855]96                { this->moveUpDown(Vector2(value, 0)); }
[7129]97
98            /**
99            @brief Rotates the SimpleRocket around the y-axis by the specifed amount.
100            @param value  The amount by which the SimpleRocket is to be rotated.
101            */
102            inline void rotateYaw(float value)
[8855]103                { this->rotateYaw(Vector2(value, 0)); }
[7129]104            /**
105            @brief Rotates the SimpleRocket around the x-axis by the specifed amount.
106            @param value  The amount by which the SimpleRocket is to be rotated.
107            */
108            inline void rotatePitch(float value)
[8855]109                { this->rotatePitch(Vector2(value, 0)); }
[7129]110            /**
111            @brief Rotates the SimpleRocket around the z-axis by the specifed amount.
112            @param value  The amount by which the SimpleRocket is to be rotated.
113            */
114            inline void rotateRoll(float value)
[8855]115                { this->rotateRoll(Vector2(value, 0)); }
[7129]116
[8855]117            virtual void setShooter(Pawn* shooter);
[8706]118
[7129]119            inline bool hasFuel() const
[8855]120                { return this->fuel_; }
[7129]121
122
123        private:
[8859]124            static const float FUEL_PERCENTAGE; //!< Percentage of lifetime the rocket has fuel
125
[8855]126            Vector3 localAngularVelocity_; //!< Variable to temporarily store accumulated steering command input.
[7129]127            bool fuel_; //!< Bool is true while the rocket "has fuel"
128
[8855]129            WeakPtr<PlayerInfo> player_; //!< The player the SimpleRocket belongs to.
130            Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out.
131            float lifetime_; //!< The time the projectile exists.
[7129]132
133            ParticleEmitter* fire_; //!< Fire-Emittor
134    };
135
136}
137
138#endif /* _SimpleRocket_H__ */
Note: See TracBrowser for help on using the repository browser.