[3078] | 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 | * Daniel 'Huty' Haggenmueller |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | @file |
---|
| 31 | @brief Definition of Jump. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | #ifndef _Jump_H__ |
---|
| 35 | #define _Jump_H__ |
---|
| 36 | |
---|
| 37 | #include <climits> |
---|
| 38 | |
---|
| 39 | #include "OrxonoxPrereqs.h" |
---|
| 40 | |
---|
[3196] | 41 | #include <climits> |
---|
| 42 | #include "util/Math.h" |
---|
[5735] | 43 | #include "pickup/UsableItem.h" |
---|
[3078] | 44 | |
---|
| 45 | namespace orxonox |
---|
| 46 | { |
---|
| 47 | /** |
---|
| 48 | @brief Jump-item, enables player to "jump" into a direction. |
---|
| 49 | */ |
---|
| 50 | class _OrxonoxExport Jump : public UsableItem |
---|
| 51 | { |
---|
| 52 | public: |
---|
| 53 | Jump(BaseObject* creator); //!< Constructor |
---|
| 54 | virtual ~Jump(); //!< Deconstructor |
---|
| 55 | |
---|
| 56 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort |
---|
| 57 | |
---|
| 58 | virtual int getMaxCarryAmount() const |
---|
| 59 | { return INT_MAX; } |
---|
| 60 | |
---|
| 61 | virtual void used(Pawn* pawn); //!< Called when the item is used. |
---|
| 62 | |
---|
| 63 | virtual bool pickedUp(Pawn* pawn); //!< Called when the item is picked up. |
---|
| 64 | virtual bool dropped(Pawn* pawn); //!< Called when the item is dropped. |
---|
| 65 | |
---|
| 66 | /** |
---|
| 67 | @brief Get the velocity added when the item is used. |
---|
| 68 | @return Returns the added velocity (relative to the Pawn). |
---|
| 69 | */ |
---|
| 70 | inline const Vector3& getVelocity() const |
---|
| 71 | { return this->velocity_; } |
---|
| 72 | /** |
---|
| 73 | @brief Set the velocity added when the item is used. |
---|
| 74 | @param velocity New added velocity (relative to Pawn). |
---|
| 75 | */ |
---|
| 76 | inline void setVelocity(const Vector3& velocity) |
---|
| 77 | { this->velocity_ = velocity; } |
---|
| 78 | /** |
---|
| 79 | @brief Get the amount of jumps available. |
---|
| 80 | @return Returns how many times the item can be used. |
---|
| 81 | */ |
---|
| 82 | inline int getJumpsAvailable() const |
---|
| 83 | { return this->jumpsAvailable_; } |
---|
| 84 | /** |
---|
| 85 | @brief Set the amount of jumps available. |
---|
| 86 | @param num New number of available jumps. |
---|
| 87 | */ |
---|
| 88 | inline void setJumpsAvailable(int num) |
---|
| 89 | { this->jumpsAvailable_ = num; } |
---|
| 90 | private: |
---|
| 91 | Vector3 velocity_; //!< The velocity added when the item is used. |
---|
| 92 | int jumpsAvailable_; //!< Amount of jumps still available. |
---|
| 93 | }; |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | #endif /* _Jump_H__ */ |
---|