Orxonox  0.0.5 Codename: Arcturus
Pickup.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 _Pickup_H__
36 #define _Pickup_H__
37 
38 #include "pickup/PickupPrereqs.h"
39 
40 #include "core/BaseObject.h"
41 #include "core/XMLPort.h"
42 #include "tools/Timer.h"
43 
44 #include "CollectiblePickup.h"
45 
46 namespace orxonox
47 {
48 
56  {
57  immediate,
58  onUse,
59  };
60 
67  enum class PickupDurationType
68  {
69  once,
70  continuous,
71  };
72 
93  {
94 
95  public:
96  Pickup(Context* context);
97  virtual ~Pickup();
98 
99  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
100 
101  virtual const std::string& getRepresentationName() const override
102  { return this->representationName_; }
103 
109  { return this->activationType_; }
115  { return this->durationType_; }
116 
117  const std::string& getActivationTypeAsString(void) const;
118  const std::string& getDurationTypeAsString(void) const;
119 
124  inline bool isImmediate(void) const
125  { return this->getActivationType() == PickupActivationType::immediate; }
130  inline bool isOnUse(void) const
131  { return this->getActivationType() == PickupActivationType::onUse; }
136  inline bool isOnce(void) const
137  { return this->getDurationType() == PickupDurationType::once; }
142  inline bool isContinuous(void) const
143  { return this->getDurationType() == PickupDurationType::continuous; }
144 
145  virtual void changedPickedUp(void) override;
146 
147  protected:
148  virtual bool createSpawner(void) override;
149 
153  inline void setRepresentationName(const std::string& name)
154  { this->representationName_ = name; }
155 
161  { this->activationType_ = type; }
167  { this->durationType_ = type; }
168 
169  void setActivationTypeAsString(const std::string& type);
170  void setDurationTypeAsString(const std::string& type);
171 
172  private:
173  void initialize(void);
174 
178 
184  };
185 
186 }
187 #endif // _Pickup_H__
The BaseObject is the parent of all classes representing an instance in the game. ...
Definition: BaseObject.h:63
Means that the Pickup will be used over a continuous timespan.
Means that the Pickup will be used only once at a singular time instant.
static const std::string durationTypeOnce_s
Definition: Pickup.h:182
#define _PickupExport
Definition: PickupPrereqs.h:60
bool isOnUse(void) const
Get whether the activation type is &#39;onUse&#39;.
Definition: Pickup.h:130
PickupActivationType activationType_
The activation type of the Pickup.
Definition: Pickup.h:176
static const std::string activationTypeOnUse_s
Definition: Pickup.h:181
::std::string string
Definition: gtest-port.h:756
void setRepresentationName(const std::string &name)
Sets the representation name which refers to the name of the PickupRepresentation that is used to rep...
Definition: Pickup.h:153
void setDurationType(PickupDurationType type)
Set the duration type of the Pickup.
Definition: Pickup.h:166
Declaration of the XMLPort helper classes and macros.
PickupDurationType durationType_
The duration type of the Pickup.
Definition: Pickup.h:177
Definition of the CollectiblePickup class.
Means that the Pickup will be used at a later point trough some external influence.
bool isImmediate(void) const
Get whether the activation type is &#39;immediate&#39;.
Definition: Pickup.h:124
xmlelement
Definition: Super.h:519
static const std::string durationTypeContinuous_s
Definition: Pickup.h:183
Declaration of the Timer class, used to call functions after a given time-interval.
Means that the Pickup will be used immediately after pickup.
bool isContinuous(void) const
Get whether the duration type is &#39;continuous&#39;.
Definition: Pickup.h:142
PickupDurationType getDurationType(void) const
Get the duration type of the Pickup.
Definition: Pickup.h:114
static const std::string activationTypeImmediate_s
Strings for the activation and duration types.
Definition: Pickup.h:180
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Mode
Definition: CorePrereqs.h:102
Declaration of BaseObject, the base class of all objects in Orxonox.
PickupActivationType getActivationType(void) const
Get the activation type of the Pickup.
Definition: Pickup.h:108
Definition: Context.h:45
PickupDurationType
Enum for the Pickup duration type.
Definition: Pickup.h:67
void setActivationType(PickupActivationType type)
Set the activation type of the Pickup.
Definition: Pickup.h:160
std::string representationName_
The name of the associated PickupRepresentation.
Definition: Pickup.h:175
The CollectiblePickup class encompasses all Pickupables that can be added to a PickupCollection and t...
Definition: CollectiblePickup.h:55
bool isOnce(void) const
Get whether the duration type is &#39;once&#39;.
Definition: Pickup.h:136
The Pickup class offers (useful) base functionality for a wide range of pickups.
Definition: Pickup.h:92
PickupActivationType
Enum for the Pickup activation type.
Definition: Pickup.h:55
Shared library macros, enums, constants and forward declarations for the questsystem module ...
virtual const std::string & getRepresentationName() const override
Returns the representation name which refers to the name of the PickupRepresentation that is used to ...
Definition: Pickup.h:101