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