Orxonox  0.0.5 Codename: Arcturus
SpaceBoundaries.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  * Maurus Kaufmann
24  * Co-authors:
25  * ...
26  *
27  */
28 
29 #ifndef _SpaceBoundaries_H__
30 #define _SpaceBoundaries_H__
31 
32 #include "objects/ObjectsPrereqs.h"
33 
34 #include <string>
35 #include <list>
36 #include <vector>
37 
38 #include "core/object/WeakPtr.h"
39 
42 
43 namespace orxonox
44 {
45 
75  {
76  public:
77  SpaceBoundaries(Context* context);
78  ~SpaceBoundaries();
79 
80  void setMaxDistance(float r);
81  float getMaxDistance();
82 
83  void setWarnDistance(float r);
84  float getWarnDistance();
85 
86  void setShowDistance(float r);
87  float getShowDistance();
88 
89  void setHealthDecrease(float amount);
90  float getHealthDecrease();
91 
92  void setReaction(int mode);
93  int getReaction();
94 
95  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
96 
97  virtual void tick(float dt) override;
98 
99  private:
100  struct BillboardAdministration{ bool usedYet; Billboard* billy; };
101 
102  // Variabeln::
103  std::list<WeakPtr<Pawn>> pawnsIn_;
104 
105  std::vector<BillboardAdministration> billboards_;
106 
107  int reaction_;
108  float maxDistance_;
114 
116 
117  //RadarViewable* centerRadar_; //!< Representation of the space boundary in the radar.
118 
119  // Funktionen::
120  float computeDistance(WorldEntity *item);
121  void displayWarning(const std::string warnText);
122  void displayBoundaries(Pawn *item, float alpha);
123  void conditionalBounceBack(Pawn *item, float currentDistance, float dt);
124  void bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity);
125  bool isHumanPlayer(Pawn *item);
126 
127  void checkWhoIsIn();
128 
129  void positionBillboard(const Vector3& position, float alpha);
130  void setBillboardOptions(Billboard *billy);
131  void removeAllBillboards();
132  };
133 }
134 
135 #endif /* _SpaceBoundaries_H__ */
#define _ObjectsExport
Definition: ObjectsPrereqs.h:60
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
The StaticEntity is the simplest derivative of the orxonox::WorldEntity class.
Definition: StaticEntity.h:50
Declaration of the Tickable interface.
bool usedYet
Definition: SpaceBoundaries.h:100
The Scripts&#39; code is executed through the CommandExecutor.
::std::string string
Definition: gtest-port.h:756
std::list< WeakPtr< Pawn > > pawnsIn_
List of the pawns that this instance of SpaceBoundaries has to handle.
Definition: SpaceBoundaries.h:103
Definition of WeakPtr<T>, wraps a pointer to an object.
SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area (until ...
Definition: SpaceBoundaries.h:74
The WorldEntity represents everything that can be put in a Scene at a certain location.
Definition: WorldEntity.h:72
xmlelement
Definition: Super.h:519
Definition: Billboard.h:43
int reaction_
Values: 0, 1, 2.
Definition: SpaceBoundaries.h:107
float healthDecrease_
Rate of health loss.
Definition: SpaceBoundaries.h:115
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
float showDistance_
Distance at which the boundaries are displayed.
Definition: SpaceBoundaries.h:113
Definition: SpaceBoundaries.h:100
Mode
Definition: CorePrereqs.h:102
Definition: Context.h:45
std::vector< BillboardAdministration > billboards_
Definition: SpaceBoundaries.h:105
Shared library macros, enums, constants and forward declarations for the objects module ...
The Tickable interface provides a tick(dt) function, that gets called every frame.
Definition: Tickable.h:52
float warnDistance_
Distance in which a warning is displayed.
Definition: SpaceBoundaries.h:112