[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: |
---|
| 23 | * Oliver Scheuss |
---|
| 24 | * Co-authors: |
---|
[8580] | 25 | * simonmie |
---|
[7129] | 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef _SimpleRocket_H__ |
---|
| 30 | #define _SimpleRocket_H__ |
---|
| 31 | |
---|
| 32 | #include "weapons/WeaponsPrereqs.h" |
---|
| 33 | |
---|
| 34 | #include "tools/Timer.h" |
---|
| 35 | #include "worldentities/ControllableEntity.h" |
---|
| 36 | #include "graphics/ParticleSpawner.h" |
---|
| 37 | |
---|
[8580] | 38 | #include "BasicProjectile.h" |
---|
| 39 | |
---|
[7129] | 40 | namespace orxonox |
---|
| 41 | { |
---|
| 42 | class ConeCollisionShape; |
---|
| 43 | |
---|
| 44 | /** |
---|
| 45 | @brief |
---|
| 46 | SimpleRocket, follows direction from a Rocketcontroller, has fuel for 80% of its lifetime, afterwards it's fire disappears. |
---|
| 47 | @author |
---|
| 48 | Gabriel Nadler (Original file: Oli Scheuss) |
---|
| 49 | */ |
---|
[8580] | 50 | class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile |
---|
[7129] | 51 | { |
---|
| 52 | public: |
---|
| 53 | SimpleRocket(BaseObject* creator); |
---|
| 54 | virtual ~SimpleRocket(); |
---|
| 55 | virtual void tick(float dt); |
---|
| 56 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleRocket through XML. |
---|
| 57 | |
---|
| 58 | virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); |
---|
| 59 | void destroyObject(); |
---|
| 60 | |
---|
| 61 | void disableFire(); //!< Method to disable the fire and stop all acceleration |
---|
| 62 | |
---|
| 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); |
---|
| 70 | void setDestroy(); |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | @brief Moves the SimpleRocket in the Front/Back-direction by the specifed amount. |
---|
| 74 | @param value The amount by which the SimpleRocket is to be moved. |
---|
| 75 | */ |
---|
| 76 | inline void moveFrontBack(float value) |
---|
| 77 | { this->moveFrontBack(Vector2(value, 0)); } |
---|
| 78 | /** |
---|
| 79 | @brief Moves the SimpleRocket in the Right/Left-direction by the specifed amount. |
---|
| 80 | @param value The amount by which the SimpleRocket is to be moved. |
---|
| 81 | */ |
---|
| 82 | inline void moveRightLeft(float value) |
---|
| 83 | { this->moveRightLeft(Vector2(value, 0)); } |
---|
| 84 | /** |
---|
| 85 | @brief Moves the SimpleRocket in the Up/Down-direction by the specifed amount. |
---|
| 86 | @param value The amount by which the SimpleRocket is to be moved. |
---|
| 87 | */ |
---|
| 88 | inline void moveUpDown(float value) |
---|
| 89 | { this->moveUpDown(Vector2(value, 0)); } |
---|
| 90 | |
---|
| 91 | /** |
---|
| 92 | @brief Rotates the SimpleRocket around the y-axis by the specifed amount. |
---|
| 93 | @param value The amount by which the SimpleRocket is to be rotated. |
---|
| 94 | */ |
---|
| 95 | inline void rotateYaw(float value) |
---|
| 96 | { this->rotateYaw(Vector2(value, 0)); } |
---|
| 97 | /** |
---|
| 98 | @brief Rotates the SimpleRocket around the x-axis by the specifed amount. |
---|
| 99 | @param value The amount by which the SimpleRocket is to be rotated. |
---|
| 100 | */ |
---|
| 101 | inline void rotatePitch(float value) |
---|
| 102 | { |
---|
| 103 | this->rotatePitch(Vector2(value, 0)); } |
---|
| 104 | /** |
---|
| 105 | @brief Rotates the SimpleRocket around the z-axis by the specifed amount. |
---|
| 106 | @param value The amount by which the SimpleRocket is to be rotated. |
---|
| 107 | */ |
---|
| 108 | inline void rotateRoll(float value) |
---|
| 109 | { |
---|
| 110 | this->rotateRoll(Vector2(value, 0)); } |
---|
| 111 | |
---|
| 112 | void setOwner(Pawn* owner); |
---|
| 113 | inline Pawn* getOwner() const |
---|
| 114 | { return this->owner_; } |
---|
[8580] | 115 | |
---|
[7129] | 116 | inline bool hasFuel() const |
---|
| 117 | { return this->fuel_; } |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | private: |
---|
| 121 | WeakPtr<Pawn> owner_; |
---|
| 122 | Vector3 localAngularVelocity_; |
---|
| 123 | bool fuel_; //!< Bool is true while the rocket "has fuel" |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | WeakPtr<PlayerInfo> player_; |
---|
| 127 | Timer destroyTimer_; |
---|
| 128 | float lifetime_; |
---|
| 129 | static const int FUEL_PERCENTAGE=80; //!<Percentage of Lifetime the rocket has fuel |
---|
| 130 | |
---|
| 131 | ParticleEmitter* fire_; //!< Fire-Emittor |
---|
| 132 | |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | }; |
---|
| 136 | |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | #endif /* _SimpleRocket_H__ */ |
---|