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 | * Damian 'Mozork' Frick |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _HealthPickup_H__ |
---|
30 | #define _HealthPickup_H__ |
---|
31 | |
---|
32 | #include "pickup/PickupPrereqs.h" |
---|
33 | |
---|
34 | #include "pickup/Pickup.h" |
---|
35 | #include "tools/interfaces/Tickable.h" |
---|
36 | #include "worldentities/StaticEntity.h" |
---|
37 | |
---|
38 | #include <string> |
---|
39 | |
---|
40 | namespace orxonox { |
---|
41 | |
---|
42 | //! Enum for the type of the HealthPickup |
---|
43 | namespace pickupHealthType |
---|
44 | { |
---|
45 | enum Value |
---|
46 | { |
---|
47 | limited, |
---|
48 | temporary, |
---|
49 | permanent |
---|
50 | }; |
---|
51 | } |
---|
52 | |
---|
53 | class _PickupExport HealthPickup : public Pickup, public Tickable |
---|
54 | { |
---|
55 | public: |
---|
56 | |
---|
57 | HealthPickup(BaseObject* creator); |
---|
58 | virtual ~HealthPickup(); |
---|
59 | |
---|
60 | virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); |
---|
61 | virtual void tick(float dt); |
---|
62 | |
---|
63 | virtual void clone(OrxonoxClass* item); |
---|
64 | |
---|
65 | virtual void changedUsed(void); |
---|
66 | |
---|
67 | protected: |
---|
68 | void initializeIdentifier(void); |
---|
69 | |
---|
70 | void setHealth(float health); |
---|
71 | void setHealthSpeed(float speed); |
---|
72 | void setHealthType(std::string type); |
---|
73 | inline void setHealthTypeDirect(pickupHealthType::Value type) |
---|
74 | { this->healthType_ = type; } |
---|
75 | |
---|
76 | inline float getHealth(void) |
---|
77 | { return this->health_; } |
---|
78 | inline float getHealthSpeed(void) |
---|
79 | { return this->healthSpeed_; } |
---|
80 | const std::string& getHealthType(void); |
---|
81 | inline pickupHealthType::Value getHealthTypeDirect(void) |
---|
82 | { return this->healthType_; } |
---|
83 | |
---|
84 | private: |
---|
85 | void initialize(void); |
---|
86 | |
---|
87 | float health_; |
---|
88 | float healthSpeed_; |
---|
89 | pickupHealthType::Value healthType_; |
---|
90 | |
---|
91 | static const std::string healthTypeLimited_s; |
---|
92 | static const std::string healthTypeTemporary_s; |
---|
93 | static const std::string healthTypePermanent_s; |
---|
94 | static const std::string blankString_s; //TODO: Maybe already implemented somewhere? |
---|
95 | |
---|
96 | }; |
---|
97 | } |
---|
98 | |
---|
99 | #endif // _HealthPickup_H__ |
---|