Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2011, 5:40:16 PM (13 years ago)
Author:
dafrick
Message:

Merging spaceboundaries2 branch into presentation branch.

Location:
code/branches/presentation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/orxonox/worldentities/SpaceBoundaries.h

    r8458 r8614  
    2626 *
    2727 */
    28  
    29  /* TODO:   - Textmessages und Billboards sollen teils nur bei einem humanPlayer angezeigt werden, nicht bei allen (vgl. Netzwerk-Spiel mit mehreren humanPlayers)
    30                 beachte hierzu folgende statische Funktion: 'static unsigned int  Host::getPlayerID()'
    31                 (file:///home/kmaurus/orxonox/spaceBoundaries/build/doc/api/html/classorxonox_1_1_host.html#9c1e3b39e3b42e467dfbf42902911ce2)
    32                
    33             - Kommentieren (Betrachte als Beispiel/Vorbild 'libraries/core/WeakPtr.h')
    34            
    35             - Wiki-SpaceBoundaries-Eintrag aktualisieren
    36  */
    3728
    3829#ifndef _SpaceBoundaries_H__
     
    4940#include <string>
    5041#include <list>
    51 #include <map>
    5242#include <vector>
    5343
     
    5848@brief SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area (until now this area is a ball).
    5949
    60        Five attributes can/should be defined in the XML-File:
     50       Some attributes can/should be defined in the XML-File:
     51       - 'position' : absolute position of the object of SpaceBoundaries in the level (usually 0,0,0)
     52       - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
    6153       - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to
    62                           inform the player that he'll soon be leaving the allowed area.
    63        - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
     54                          inform the player that he'll soon be leaving the allowed area. (not implemented yet!)
    6455       - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown.
    65        - 'healthDecrease' : a measure to define how fast the health of a pawn should decrease after leaving the allowed area (unnecessary if 'reactionMode' == 0).
    66                             Recommended values: 0.1 (slow health decrease) to 5 (very fast health decrease)
    6756       - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
    6857                            0: Reflect the space ship (default).
    6958                            1: Decrease Health of the space ship after having left the allowed area.
     59                            2: Inverted Version of 0. Prohibit to fly INTO a defined area.
     60       - 'healthDecrease' : a measure to define how fast the health of a pawn should decrease after leaving the allowed area (unnecessary if 'reactionMode' == 0).
     61                            Recommended values: 0.1 (slow health decrease) to 5 (very fast health decrease)
     62
     63Follow http://www.orxonox.net/wiki/SpaceBoundaries to get some further information.
     64
     65Examples:
     66Two examples how one could include SpaceBoundaries in the XML-File. The first one uses reflection, the second one health decrease.
     67@code
     68<SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="0" />
     69@endcode
     70
     71@code
     72<SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="1" healthDecrease="0.2" />
     73@endcode
    7074*/
    7175
     
    7579            SpaceBoundaries(BaseObject* creator);
    7680            ~SpaceBoundaries();
    77            
    78             void checkWhoIsIn(); //!< Update the list 'pawnsIn_'.
    79            
    80             void positionBillboard(const Vector3 position); //!< Display a Billboard at the position 'position'.
    81             void setBillboardOptions(Billboard *billy);
    82             void removeAllBillboards(); //!< Hide all all elements of '*billboard_' and set their attribute 'usedYet' to 0.
    8381           
    8482            void setMaxDistance(float r);
     
    104102            struct billboardAdministration{ bool usedYet; Billboard* billy; };
    105103           
     104            // Variabeln::
    106105            std::list<WeakPtr<Pawn> > pawnsIn_; //!< List of the pawns that this instance of SpaceBoundaries has to handle.
    107106           
    108107            std::vector<billboardAdministration> billboards_;
    109108       
    110             int reaction_; //!< Werte: 0, 1. 0: Reflektion an Boundaries (Standard). 1: Health-Abzug-Modus.
    111             float maxDistance_; //!< maximal zulaessige Entfernung von 'this->getPosition()'.
    112             float warnDistance_; //!< Entfernung von 'this->getPosition()', ab der eine Warnung angezeigt wird, dass man bald das zulaessige Areal verlaesst.
    113             float showDistance_; //!< Definiert, wann die Grenzen visualisiert werden sollen.
     109            int reaction_; //!< Values: 0, 1, 2.
     110                           //!< 0: Reflection on boundary (Standard).
     111                           //!< 1: Decrease-Health-Mode.
     112                           //!< 2: Inverted Version of 0. Prohibit to fly INTO a defined area.
     113            float maxDistance_; //!<  Maximum allowed distance.
     114            float warnDistance_; //!< Distance in which a warning is displayed.
     115            float showDistance_; //!< Distance at which the boundaries are displayed.
    114116           
    115             float healthDecrease_; //!< Mass fuer die Anzahl Health-Points, die nach ueberschreiten der Entfernung 'maxDistance_' von 'this->getPosition()' abgezogen werden.
    116                                    //!< Empfohlene Werte: 0.1 (langsame Health-Verminderung) bis 5 (sehr schnelle Health-Verminderung)
     117            float healthDecrease_; //!< Rate of health loss.
    117118           
    118             RadarViewable* centerRadar_; //!< Repraesentation von SpaceBoundaries auf dem Radar.
     119            //RadarViewable* centerRadar_; //!< Representation of the space boundary in the radar.
    119120       
    120             float computeDistance(WorldEntity *item); //!< Auf den Mittelpunkt 'this->getPosition()' bezogen.
    121             void displayWarning(const std::string warnText);
     121            // Funktionen::
     122            float computeDistance(WorldEntity *item); //!< Compute distance to center point.
     123            void displayWarning(const std::string warnText); //!< TODO: Implement.
    122124            void displayBoundaries(Pawn *item);
    123125            void conditionalBounceBack(Pawn *item, float currentDistance, float dt);
     126            void bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity);
    124127            bool isHumanPlayer(Pawn *item);
     128           
     129            void checkWhoIsIn(); //!< Update the list 'pawnsIn_'.
     130           
     131            void positionBillboard(const Vector3 position); //!< Display a Billboard at the position 'position'.
     132            void setBillboardOptions(Billboard *billy);
     133            void removeAllBillboards(); //!< Hide all elements of '*billboard_' and set their attribute 'usedYet' to 0.
    125134           
    126135    };
Note: See TracChangeset for help on using the changeset viewer.