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