Orxonox  0.0.5 Codename: Arcturus
Rocket.h
Go to the documentation of this file.
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 
34 #ifndef _Rocket_H__
35 #define _Rocket_H__
36 
37 #include "weapons/WeaponsPrereqs.h"
38 
39 #include "tools/Timer.h"
40 
43 
44 #include "BasicProjectile.h"
45 
46 namespace orxonox
47 {
48  class ConeCollisionShape;
49 
59  {
60  public:
61  Rocket(Context* context);
62  virtual ~Rocket();
63 
64  virtual void tick(float dt) override;
65 
66  virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override;
67  virtual void destroyObject(void) override;
68  void destructionEffect();
69 
70  virtual void moveFrontBack(const Vector2& value) override {}
71  virtual void moveRightLeft(const Vector2& value) override {}
72  virtual void moveUpDown(const Vector2& value) override {}
73 
74  virtual void rotateYaw(const Vector2& value) override;
75  virtual void rotatePitch(const Vector2& value) override;
76  virtual void rotateRoll(const Vector2& value) override;
77 
82  inline void moveFrontBack(float value)
83  { this->moveFrontBack(Vector2(value, 0)); }
88  inline void moveRightLeft(float value)
89  { this->moveRightLeft(Vector2(value, 0)); }
94  inline void moveUpDown(float value)
95  { this->moveUpDown(Vector2(value, 0)); }
96 
101  inline void rotateYaw(float value)
102  { this->rotateYaw(Vector2(value, 0)); }
107  inline void rotatePitch(float value)
108  { this->rotatePitch(Vector2(value, 0)); }
113  inline void rotateRoll(float value)
114  { this->rotateRoll(Vector2(value, 0)); }
115 
116  virtual void setShooter(Pawn* shooter) override;
117 
118  virtual void fired(unsigned int firemode) override;
119 
123  void setMaxFuel(float fuel);
127  inline float getMaxFuel() const
128  { return lifetime_; }
129  float getFuel() const;
130 
131  private:
133 
135  //WeakPtr<Pawn> pawn_; //!< The pawn that controls the Rocket. TODO
137  float lifetime_;
138 
141  };
142 
143 }
144 
145 #endif /* _Rocket_H__ */
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
void rotatePitch(float value)
Rotates the Rocket around the x-axis by the specifed amount.
Definition: Rocket.h:107
void moveRightLeft(float value)
Moves the Rocket in the Right/Left-direction by the specifed amount.
Definition: Rocket.h:88
virtual void moveFrontBack(const Vector2 &value) override
Definition: Rocket.h:70
void rotateRoll(float value)
Rotates the Rocket around the z-axis by the specifed amount.
Definition: Rocket.h:113
The WorldSound class is to be used for sounds with position and orientation.
Definition: WorldSound.h:44
void moveFrontBack(float value)
Moves the Rocket in the Front/Back-direction by the specifed amount.
Definition: Rocket.h:82
void rotateYaw(float value)
Rotates the Rocket around the y-axis by the specifed amount.
Definition: Rocket.h:101
Shared library macros, enums, constants and forward declarations for the weapons module ...
float getMaxFuel() const
Get the maximum lifetime of the rocket.
Definition: Rocket.h:127
Timer destroyTimer_
Timer to destroy the projectile after its lifetime has run out.
Definition: Rocket.h:136
void moveUpDown(float value)
Moves the Rocket in the Up/Down-direction by the specifed amount.
Definition: Rocket.h:94
virtual void moveRightLeft(const Vector2 &value) override
Definition: Rocket.h:71
Interface for receiving window events.
Definition: RadarViewable.h:48
WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted.
Definition: CorePrereqs.h:236
Rocket that can be steered by the player.
Definition: Rocket.h:58
The WorldEntity represents everything that can be put in a Scene at a certain location.
Definition: WorldEntity.h:72
Declaration of the Timer class, used to call functions after a given time-interval.
Vector3 localAngularVelocity_
Variable to temporarily store accumulated steering command input.
Definition: Rocket.h:132
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
WeakPtr< PlayerInfo > player_
The player that controls the Rocket.
Definition: Rocket.h:134
float lifetime_
The time the projectile exists.
Definition: Rocket.h:137
WorldSound * defSndWpnLaunch_
Launch sound.
Definition: Rocket.h:140
Definition: Context.h:45
Implementation of the BasicProjectile class.
Baseclass of all projectiles.
Definition: BasicProjectile.h:54
virtual void moveUpDown(const Vector2 &value) override
Definition: Rocket.h:72
WorldSound * defSndWpnEngine_
Engine sound.
Definition: Rocket.h:139
Timer is a helper class that executes a function after a given amount of seconds in game-time...
Definition: Timer.h:105
The ControllableEntity is derived from the orxonox::MobileEntity.
Definition: ControllableEntity.h:48
#define _WeaponsExport
Definition: WeaponsPrereqs.h:60