[11539] | 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 | * Oli Scheuss |
---|
| 24 | * Co-authors: |
---|
| 25 | * Damian 'Mozork' Frick |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef _Arrow_H__ |
---|
| 30 | #define _Arrow_H__ |
---|
| 31 | |
---|
| 32 | #include "OrxonoxPrereqs.h" |
---|
| 33 | |
---|
| 34 | #include "core/XMLPort.h" |
---|
[11559] | 35 | //#include "controllers/ArrowController.h" |
---|
[11539] | 36 | |
---|
| 37 | #include "ControllableEntity.h" |
---|
[11559] | 38 | #include "WorldEntity.h" |
---|
[11539] | 39 | |
---|
| 40 | namespace orxonox { |
---|
| 41 | |
---|
| 42 | /** |
---|
| 43 | @brief |
---|
| 44 | Drone, that is made to move upon a specified pattern. |
---|
| 45 | This class was constructed for the PPS tutorial. |
---|
| 46 | @author |
---|
| 47 | Oli Scheuss |
---|
| 48 | */ |
---|
| 49 | class _OrxonoxExport Arrow : public ControllableEntity |
---|
| 50 | { |
---|
| 51 | public: |
---|
| 52 | Arrow(Context* context); |
---|
| 53 | virtual ~Arrow(); |
---|
| 54 | |
---|
| 55 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an Arrow through XML. |
---|
| 56 | virtual void tick(float dt); //!< Defines which actions the Arrow has to take in each tick. |
---|
| 57 | |
---|
| 58 | virtual void moveFrontBack(const Vector2& value); |
---|
| 59 | virtual void moveRightLeft(const Vector2& value); |
---|
| 60 | virtual void moveUpDown(const Vector2& value); |
---|
| 61 | |
---|
| 62 | virtual void rotateYaw(const Vector2& value); |
---|
| 63 | virtual void rotatePitch(const Vector2& value); |
---|
| 64 | virtual void rotateRoll(const Vector2& value); |
---|
| 65 | |
---|
| 66 | /** |
---|
| 67 | @brief Moves the Drone in the Front/Back-direction by the specifed amount. |
---|
| 68 | @param value The amount by which the drone is to be moved. |
---|
| 69 | */ |
---|
| 70 | inline void moveFrontBack(float value) |
---|
| 71 | { this->moveFrontBack(Vector2(value, 0)); } |
---|
| 72 | /** |
---|
| 73 | @brief Moves the Drone in the Right/Left-direction by the specifed amount. |
---|
| 74 | @param value The amount by which the drone is to be moved. |
---|
| 75 | */ |
---|
| 76 | inline void moveRightLeft(float value) |
---|
| 77 | { this->moveRightLeft(Vector2(value, 0)); } |
---|
| 78 | /** |
---|
| 79 | @brief Moves the Drone in the Up/Down-direction by the specifed amount. |
---|
| 80 | @param value The amount by which the drone is to be moved. |
---|
| 81 | */ |
---|
| 82 | inline void moveUpDown(float value) |
---|
| 83 | { this->moveUpDown(Vector2(value, 0)); } |
---|
| 84 | |
---|
| 85 | /** |
---|
| 86 | @brief Rotates the Drone around the y-axis by the specifed amount. |
---|
| 87 | @param value The amount by which the drone is to be rotated. |
---|
| 88 | */ |
---|
| 89 | inline void rotateYaw(float value) |
---|
| 90 | { this->rotateYaw(Vector2(value, 0)); } |
---|
| 91 | /** |
---|
| 92 | @brief Rotates the Drone around the x-axis by the specifed amount. |
---|
| 93 | @param value The amount by which the drone is to be rotated. |
---|
| 94 | */ |
---|
| 95 | inline void rotatePitch(float value) |
---|
| 96 | { this->rotatePitch(Vector2(value, 0)); } |
---|
| 97 | /** |
---|
| 98 | @brief Rotates the Drone around the z-axis by the specifed amount. |
---|
| 99 | @param value The amount by which the drone is to be rotated. |
---|
| 100 | */ |
---|
| 101 | inline void rotateRoll(float value) |
---|
| 102 | { this->rotateRoll(Vector2(value, 0)); } |
---|
| 103 | |
---|
| 104 | /** |
---|
| 105 | @brief Sets the primary thrust to the input amount. |
---|
| 106 | @param thrust The amount of thrust. |
---|
| 107 | */ |
---|
| 108 | inline void setPrimaryThrust( float thrust ) |
---|
| 109 | { this->primaryThrust_ = thrust; } |
---|
| 110 | //TODO: Place your set-functions here. |
---|
| 111 | |
---|
| 112 | inline void setAuxiliaryThrust ( float thrust ) |
---|
| 113 | { this -> auxiliaryThrust_ = thrust; } |
---|
| 114 | |
---|
| 115 | inline void setRotationThrust (float thrust) |
---|
| 116 | { this -> rotationThrust_ = thrust;} |
---|
| 117 | // Hint: auxiliary thrust, rotation thrust. |
---|
| 118 | |
---|
| 119 | /** |
---|
| 120 | @brief Gets the primary thrust to the input amount. |
---|
| 121 | @return The amount of thrust. |
---|
| 122 | */ |
---|
| 123 | inline float getPrimaryThrust() |
---|
| 124 | { return this->primaryThrust_; } |
---|
| 125 | |
---|
| 126 | inline float getAuxiliaryThrust() |
---|
| 127 | { return this->auxiliaryThrust_;} |
---|
| 128 | |
---|
| 129 | inline float getRotationThrust() |
---|
| 130 | { return this->rotationThrust_;} |
---|
| 131 | |
---|
| 132 | //TODO: Place your get-functions here. |
---|
| 133 | |
---|
| 134 | private: |
---|
[11559] | 135 | //ArrowController *myController_; //!< The controller of the Arrow. |
---|
[11539] | 136 | |
---|
| 137 | btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the Arrow the next tick. |
---|
| 138 | btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the Arrow the next tick. |
---|
| 139 | float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward. |
---|
| 140 | float auxiliaryThrust_; //!< The amount of auxiliary thrust. Used for all other movements (except for rotations). |
---|
| 141 | float rotationThrust_; //!< The amount of rotation thrust. Used for rotations only.s |
---|
| 142 | |
---|
| 143 | }; |
---|
| 144 | |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | #endif // _Arrow_H__ |
---|