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