[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 HealthUsable. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | #ifndef _HealthUsable_H__ |
---|
| 35 | #define _HealthUsable_H__ |
---|
| 36 | |
---|
| 37 | #include "OrxonoxPrereqs.h" |
---|
| 38 | |
---|
[3196] | 39 | #include <climits> |
---|
[3079] | 40 | #include "objects/pickup/UsableItem.h" |
---|
[3078] | 41 | |
---|
| 42 | namespace orxonox |
---|
| 43 | { |
---|
| 44 | /** |
---|
| 45 | @brief Health-item, enables player recover health when used. |
---|
| 46 | */ |
---|
| 47 | class _OrxonoxExport HealthUsable : public UsableItem |
---|
| 48 | { |
---|
| 49 | public: |
---|
| 50 | HealthUsable(BaseObject* creator); //!< Constructor |
---|
| 51 | virtual ~HealthUsable(); //!< Deconstructor |
---|
| 52 | |
---|
| 53 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort |
---|
| 54 | |
---|
| 55 | virtual int getMaxCarryAmount() const |
---|
| 56 | { return INT_MAX; } |
---|
| 57 | |
---|
| 58 | virtual void used(Pawn* pawn); //!< Called when the item is used. |
---|
| 59 | |
---|
| 60 | virtual bool pickedUp(Pawn* pawn); //!< Called when the item is picked up. |
---|
| 61 | virtual bool dropped(Pawn* pawn); //!< Called when the item is dropped. |
---|
| 62 | |
---|
| 63 | /** |
---|
| 64 | @brief Get the amount of jumps available. |
---|
| 65 | @return Returns how many times the item can be used. |
---|
| 66 | */ |
---|
| 67 | inline float getRecoveredHealth() const |
---|
| 68 | { return this->recoveredHealth_; } |
---|
| 69 | /** |
---|
| 70 | @brief Set the amount of jumps available. |
---|
| 71 | @param num New number of available jumps. |
---|
| 72 | */ |
---|
| 73 | inline void setRecoveredHealth(float recovery) |
---|
| 74 | { this->recoveredHealth_ = recovery; } |
---|
| 75 | private: |
---|
| 76 | float recoveredHealth_; //!< Amount of jumps still available. |
---|
| 77 | }; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | #endif /* _HealthUsable_H__ */ |
---|