Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/spaceboundaries/src/orxonox/worldentities/SpaceBoundaries.h @ 8201

Last change on this file since 8201 was 8201, checked in by kmaurus, 13 years ago

healthDecreasing added, position of SpaceBoundaries added to the radar

File size: 3.4 KB
Line 
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 /* TODO: - Markiere SpaceBoundaries-Position mit einem schoenen Objekt
30          - Kugel-Model mal hinzufuegen, das nur sichtbar ist, wenn man genuegend nah an maxDistance dran ist
31          - Reflexion an obiger Kugel beim Versuch durchzudringen
32 */
33
34#ifndef _SpaceBoundaries_H__
35#define _SpaceBoundaries_H__
36
37/* Einige, spezifische include-Statements */
38#include "core/CoreIncludes.h"
39#include "tools/interfaces/Tickable.h"
40#include "interfaces/RadarViewable.h"
41#include "worldentities/StaticEntity.h"
42#include "worldentities/WorldEntity.h"
43
44//#include <ColoredTextAreaOverlayElementFactory.h>
45
46#include <string>
47
48/**
49@brief SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area.
50
51       Four attributes can/should be defined in the XML-File:
52       'position', 'warnDistance', 'maxDistance', 'healthDecrease'.
53*/
54
55namespace orxonox
56{
57    class _OrxonoxExport SpaceBoundaries : public StaticEntity, public Tickable
58    {
59        public:
60            SpaceBoundaries(BaseObject* creator);
61            ~SpaceBoundaries();
62           
63            void setMaxDistance(float r);
64            float getMaxDistance();
65           
66            void setWarnDistance(float r);
67            float getWarnDistance();
68           
69            void setHealthDecrease(float amount);
70            float getHealthDecrease();
71
72            void XMLPort(Element& xmlelement, XMLPort::Mode mode);
73           
74            void tick(float dt);
75
76        private:
77            float maxDistance_; //!< maximal zulaessige Entfernung von 'this->getPosition()'.
78            float warnDistance_; //!< Entfernung von 'this->getPosition()', ab der eine Warnung angezeigt wird, dass man bald das zulaessige Areal verlaesst.
79           
80            float healthDecrease_; //!< Mass fuer die Anzahl Health-Points, die nach ueberschreiten der Entfernung 'maxDistance_' von 'this->getPosition()' abgezogen werden.
81                                   //!< Empfohlene Werte: 0.1 (langsame Health-Verminderung) bis 5 (sehr schnelle Health-Verminderung)
82           
83            RadarViewable* centerRadar_; //!< Repraesentation von 'this->getPosition()' auf dem Radar.
84       
85            float computeDistance(WorldEntity *item); //!< Auf den Mittelpunkt 'this->getPosition()' bezogen.
86            void displayWarning(const std::string warnText);
87            bool isHumanPlayer(Pawn *item);
88           
89 //           ColoredTextAreaOverlayElementFactory* pColoredTextAreaOverlayElementFactory;
90    };
91}
92
93#endif /* _SpaceBoundaries_H__ */
Note: See TracBrowser for help on using the repository browser.