Orxonox  0.0.5 Codename: Arcturus
DistanceMultiTrigger.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 _DistanceMultiTrigger_H__
36 #define _DistanceMultiTrigger_H__
37 
38 #include "objects/ObjectsPrereqs.h"
39 
40 #include <map>
41 
42 #include "core/object/WeakPtr.h"
43 
45 
46 #include "MultiTrigger.h"
47 
48 namespace orxonox
49 {
50 
58  off,
59  identify,
60  exclude
61  };
62 
91  {
92 
93  public:
94  DistanceMultiTrigger(Context* context); // Default Constructor. Registers the object and initializes default values.
95  virtual ~DistanceMultiTrigger(); // Destructor.
96 
97  void XMLPort(Element& xmlelement, XMLPort::Mode mode); // Method for creating a DistanceMultiTrigger object through XML.
98 
103  inline void setDistance(float distance)
104  { if(distance >= 0) this->distance_ = distance; }
109  inline float getDistance() const
110  { return this->distance_; }
111 
112  void setBeaconModeDirect(DistanceMultiTriggerBeaconMode mode); // Set the beacon mode.
118  { return this->beaconMode_; }
119  void setBeaconMode(const std::string& mode); // Set the beacon mode.
120  const std::string& getBeaconMode(void) const; // Get the beacon mode.
121 
126  inline void setTargetName(const std::string& targetname)
127  { this->targetName_ = targetname; }
132  inline const std::string& getTargetName(void) const
133  { return this->targetName_; }
134 
135  protected:
136  virtual std::queue<MultiTriggerState*>* letTrigger(void); // This method is called by the MultiTrigger to get information about new trigger events that need to be looked at.
137 
138  bool addToRange(WorldEntity* entity); // Add a given entity to the entities, that currently are in range of the DistanceMultiTrigger.
139 
140  private:
145 
146  float distance_;
147 
151 
152  std::set<WeakPtr<WorldEntity>> range_;
153 
154  };
155 
156 }
157 
158 #endif // _DistanceMultiTrigger_H__
#define _ObjectsExport
Definition: ObjectsPrereqs.h:60
float getDistance() const
Get the distance at which the DistanceMultiTrigger triggers.
Definition: DistanceMultiTrigger.h:109
The ClassTreeMask is a set of rules, containing the information for each class whether it&#39;s included ...
Definition: ClassTreeMask.h:187
The DistanceTrigger is in identify-mode.
void setTargetName(const std::string &targetname)
Set the target name of DistanceTriggerBeacons that triggers this DistanceMultiTrigger.
Definition: DistanceMultiTrigger.h:126
std::set< WeakPtr< WorldEntity > > range_
The set of entities that currently are in range of the DistanceMultiTrigger.
Definition: DistanceMultiTrigger.h:152
ClassTreeMask beaconMask_
A mask, that only accepts DistanceTriggerBeacons.
Definition: DistanceMultiTrigger.h:150
::std::string string
Definition: gtest-port.h:756
static const std::string beaconModeIdentify_s
Definition: DistanceMultiTrigger.h:143
std::string targetName_
The target name, used in single-target mode.
Definition: DistanceMultiTrigger.h:149
The DistanceMultiTrigger is a MultiTrigger that triggers whenever an object (that is of the specified...
Definition: DistanceMultiTrigger.h:90
Definition of WeakPtr<T>, wraps a pointer to an object.
The WorldEntity represents everything that can be put in a Scene at a certain location.
Definition: WorldEntity.h:72
The DistanceMultiTrigger is not in beacon-mode.
The DistanceTrigger is in exclude-mode.
xmlelement
Definition: Super.h:519
float distance_
The distance at which the DistanceMultiTrigger triggers.
Definition: DistanceMultiTrigger.h:146
DistanceMultiTriggerBeaconMode getBeaconModeDirect(void) const
Get the beacon mode.
Definition: DistanceMultiTrigger.h:117
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Mode
Definition: CorePrereqs.h:102
Definition of the MultiTrigger class.
DistanceMultiTriggerBeaconMode beaconMode_
The beacon mode, the DistanceMultiTrigger is in.
Definition: DistanceMultiTrigger.h:148
void setDistance(float distance)
Set the distance at which the DistanceMultiTrigger triggers.
Definition: DistanceMultiTrigger.h:103
Definition: Context.h:45
static const std::string beaconModeExlcude_s
Definition: DistanceMultiTrigger.h:144
Shared library macros, enums, constants and forward declarations for the objects module ...
DistanceMultiTriggerBeaconMode
Enum for the beacon mode of the DistanceMultiTrigger.
Definition: DistanceMultiTrigger.h:57
const std::string & getTargetName(void) const
Get the target name of the DistanceTriggerbeacon, that triggers this DistanceMultiTrigger.
Definition: DistanceMultiTrigger.h:132
static const std::string beaconModeOff_s
Strings for the beacon modes.
Definition: DistanceMultiTrigger.h:142
The MultiTrigger class implements a trigger that has a distinct state for each object triggering it...
Definition: MultiTrigger.h:98