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