Orxonox  0.0.5 Codename: Arcturus
PartDestructionEvent.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  * Noe Pedrazzini
24  * Co-authors:
25  * ...
26  *
27  */
28 
29 #ifndef _PartDestructionEvent_H__
30 #define _PartDestructionEvent_H__
31 
32 #include "OrxonoxPrereqs.h"
33 #include "Item.h"
34 
35 #include <string>
36 
37 
38 namespace orxonox // tolua_export
39 { // tolua_export
74  class _OrxonoxExport PartDestructionEvent // tolua_export
75  : public Item
76  { // tolua_export
77 
78  public:
79 
84  enum class TargetParam
85  {
86  shieldhealth,
87  maxshieldhealth,
88  shieldabsorption,
89  shieldrechargerate,
90  boostpower, // Amount of available boost
91  boostpowerrate, // Recharge-rate of boost
92  rotationthrust,
93  boostfactor,
94  speedfront,
95  accelerationfront,
96  null
97  };
98 
99  PartDestructionEvent(Context* context);
100  virtual ~PartDestructionEvent();
101 
102  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
103 
104  void execute();
105 
106  inline void setValid(bool valid)
107  { this->valid_ = valid; }
108  inline bool isValid()
109  { return this->valid_; }
110 
111  void setParent(ShipPart* parent);
112  inline ShipPart* getParent()
113  { return this->parent_; }
114 
115  void setTargetType(std::string type);
117  { return this->targetType_; }
118 
119  void setTargetName(std::string name);
121  { return this->targetName_; }
122 
123  void setTargetParam(std::string param);
125  { return this->targetName_; }
126 
127  void setOperation(std::string operation);
129  { return this->operation_; }
130 
131  void setMessage(std::string msg);
133  { return this->message_; }
134 
135  float operate(float input);
136 
137  void setEventValue(float value);
138  inline float getEventValue()
139  { return this->value_; }
140 
141  protected:
142 
143  private:
144 
146  bool valid_;
147 
152  float value_;
154 
155 
156 
157  }; // tolua_export
158 } // tolua_export
159 
160 #endif /* _PartDestructionEvent_H__ */
std::string getTargetName()
Definition: PartDestructionEvent.h:120
std::string getTargetParam()
Definition: PartDestructionEvent.h:124
float value_
The value used to do the operation.
Definition: PartDestructionEvent.h:152
::std::string string
Definition: gtest-port.h:756
void setValid(bool valid)
Definition: PartDestructionEvent.h:106
std::string operation_
The operation to be applied.
Definition: PartDestructionEvent.h:151
Definition: ShipPart.h:41
std::string getTargetType()
Definition: PartDestructionEvent.h:116
ShipPart * parent_
Pointer to the ShipPart this event belongs to.
Definition: PartDestructionEvent.h:145
TargetParam
List of all allowed parameters.
Definition: PartDestructionEvent.h:84
xmlelement
Definition: Super.h:519
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
std::string message_
The message which is shown in chat when the event is executed.
Definition: PartDestructionEvent.h:153
Definition: Item.h:39
Mode
Definition: CorePrereqs.h:102
float getEventValue()
Definition: PartDestructionEvent.h:138
Shared library macros, enums, constants and forward declarations for the orxonox library ...
ShipPart * getParent()
Definition: PartDestructionEvent.h:112
Definition: Context.h:45
#define _OrxonoxExport
Definition: OrxonoxPrereqs.h:60
bool isValid()
Definition: PartDestructionEvent.h:108
std::string getOperation()
Definition: PartDestructionEvent.h:128
std::string targetName_
The name of the target.
Definition: PartDestructionEvent.h:149
bool valid_
Whether this event is valid or not.
Definition: PartDestructionEvent.h:146
TargetParam targetParam_
The parameter to be modified.
Definition: PartDestructionEvent.h:150
std::string targetType_
The type of the target. (ship weapon engine)
Definition: PartDestructionEvent.h:148
In order to assign attached entities to a ShipPart, a ShipPart with the same name as the correspondin...
Definition: PartDestructionEvent.h:74
std::string getMessage()
Definition: PartDestructionEvent.h:132