Orxonox  0.0.5 Codename: Arcturus
HealthPickup.h
Go to the documentation of this file.
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 
35 #ifndef _HealthPickup_H__
36 #define _HealthPickup_H__
37 
38 #include "pickup/PickupPrereqs.h"
39 
40 #include <string>
41 
42 #include "pickup/Pickup.h"
44 
45 namespace orxonox {
46 
53  enum class PickupHealthType
54  {
55  limited,
56  temporary,
57  permanent
58  };
59 
85  class _PickupExport HealthPickup : public Pickup, public Tickable
86  {
87  public:
88 
89  HealthPickup(Context* context);
90  virtual ~HealthPickup();
91 
92  virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode);
93  virtual void tick(float dt);
94 
95  virtual void changedUsed(void);
96 
101  inline float getHealth(void) const
102  { return this->health_; }
107  inline float getHealthRate(void) const
108  { return this->healthRate_; }
109 
114  inline PickupHealthType getHealthType(void) const
115  { return this->healthType_; }
116  const std::string& getHealthTypeAsString(void) const;
117 
118  protected:
119  void setHealth(float health);
120  void setHealthRate(float speed);
121 
126  inline void setHealthType(PickupHealthType type)
127  { this->healthType_ = type; }
128  void setHealthTypeAsString(const std::string& type);
129 
130  private:
131  void initialize(void);
132  Pawn* carrierToPawnHelper(void);
133 
134  float health_;
135  float healthRate_;
139 
144 
145  };
146 }
147 
148 #endif // _HealthPickup_H__
Means that the HealthPickup increases the users health even above its maximum health and increases th...
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
#define _PickupExport
Definition: PickupPrereqs.h:60
Means that the HealthPickup temporarily increases the users health even above its maximum health...
Declaration of the Pickup class.
Declaration of the Tickable interface.
PickupHealthType getHealthType(void) const
Get the type of HealthPickup, this pickup is.
Definition: HealthPickup.h:114
float maxHealthOverwrite_
Helper to remember with which value we overwrote the maxHealh, to detect if someone else changed it a...
Definition: HealthPickup.h:137
::std::string string
Definition: gtest-port.h:756
The HealthPickup is a Pickupable that can do (dependent upon the parameters) lots of different things...
Definition: HealthPickup.h:85
float getHealthRate(void) const
Get the rate at which the health is transferred to the Pawn, if this pickup has duration type &#39;contin...
Definition: HealthPickup.h:107
void setHealthType(PickupHealthType type)
Set the health type of this pickup.
Definition: HealthPickup.h:126
static const std::string healthTypeLimited_s
Strings for the health types.
Definition: HealthPickup.h:141
PickupHealthType healthType_
The type of the HealthPickup.
Definition: HealthPickup.h:138
xmlelement
Definition: Super.h:519
static const std::string healthTypeTemporary_s
Definition: HealthPickup.h:142
Means that the HealthPickup only increases the users health to its maximum health.
float maxHealthSave_
Helper to remember what the actual maxHealth of the Pawn was before we changed it.
Definition: HealthPickup.h:136
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Mode
Definition: CorePrereqs.h:102
PickupHealthType
Enum for the type of the HealthPickup.
Definition: HealthPickup.h:53
Definition: Context.h:45
float health_
The health that is transferred to the Pawn.
Definition: HealthPickup.h:134
float getHealth(void) const
Get the health that is transferred to the Pawn upon usage of this pickup.
Definition: HealthPickup.h:101
The Pickup class offers (useful) base functionality for a wide range of pickups.
Definition: Pickup.h:92
static const std::string healthTypePermanent_s
Definition: HealthPickup.h:143
Shared library macros, enums, constants and forward declarations for the questsystem module ...
The Tickable interface provides a tick(dt) function, that gets called every frame.
Definition: Tickable.h:52
float healthRate_
The rate at which the health is transferred.
Definition: HealthPickup.h:135