Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 20, 2011, 11:27:45 PM (13 years ago)
Author:
dafrick
Message:

Some cleanup…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/objects/SpaceBoundaries.h

    r8706 r8767  
    4545{
    4646
    47 /**
    48 @brief SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area (until now this area is a ball).
     47    /**
     48    @brief SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area (until now this area is a ball).
    4949
    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).
    53        - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to
    54                           inform the player that he'll soon be leaving the allowed area. (not implemented yet!)
    55        - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown.
    56        - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
    57                             0: Reflect the space ship (default).
    58                             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)
     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).
     53        - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to
     54                            inform the player that he'll soon be leaving the allowed area. (not implemented yet!)
     55        - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown.
     56        - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
     57                                0: Reflect the space ship (default).
     58                                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)
    6262
    63 Follow http://www.orxonox.net/wiki/SpaceBoundaries to get some further information.
     63        Follow http://www.orxonox.net/wiki/SpaceBoundaries to get some further information.
    6464
    65 Examples:
    66 Two 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
     65        Examples:
     66        Two 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
    7070
    71 @code
    72 <SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="1" healthDecrease="0.2" />
    73 @endcode
    74 */
    75 
     71        @code
     72        <SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="1" healthDecrease="0.2" />
     73        @endcode
     74    */
    7675    class _ObjectsExport SpaceBoundaries : public StaticEntity, public Tickable
    7776    {
     
    7978            SpaceBoundaries(BaseObject* creator);
    8079            ~SpaceBoundaries();
    81            
     80
    8281            void setMaxDistance(float r);
    8382            float getMaxDistance();
    84            
     83
    8584            void setWarnDistance(float r);
    8685            float getWarnDistance();
    87            
     86
    8887            void setShowDistance(float r);
    8988            float getShowDistance();
    90            
     89
    9190            void setHealthDecrease(float amount);
    9291            float getHealthDecrease();
    93            
     92
    9493            void setReaction(int mode);
    9594            int getReaction();
    9695
    9796            void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    98            
     97
    9998            void tick(float dt);
    10099
    101100        private:
    102101            struct BillboardAdministration{ bool usedYet; Billboard* billy; };
    103            
     102
    104103            // Variabeln::
    105104            std::list<WeakPtr<Pawn> > pawnsIn_; //!< List of the pawns that this instance of SpaceBoundaries has to handle.
    106            
     105
    107106            std::vector<BillboardAdministration> billboards_;
    108        
     107
    109108            int reaction_; //!< Values: 0, 1, 2.
    110109                           //!< 0: Reflection on boundary (Standard).
     
    114113            float warnDistance_; //!< Distance in which a warning is displayed.
    115114            float showDistance_; //!< Distance at which the boundaries are displayed.
    116            
     115
    117116            float healthDecrease_; //!< Rate of health loss.
    118            
     117
    119118            //RadarViewable* centerRadar_; //!< Representation of the space boundary in the radar.
    120        
     119
    121120            // Funktionen::
    122121            float computeDistance(WorldEntity *item); //!< Compute distance to center point.
     
    126125            void bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity);
    127126            bool isHumanPlayer(Pawn *item);
    128            
     127
    129128            void checkWhoIsIn(); //!< Update the list 'pawnsIn_'.
    130            
     129
    131130            void positionBillboard(const Vector3& position, float alpha); //!< Display a Billboard at the position 'position'.
    132131            void setBillboardOptions(Billboard *billy);
    133132            void removeAllBillboards(); //!< Hide all elements of '*billboard_' and set their attribute 'usedYet' to 0.
    134            
    135133    };
    136134}
Note: See TracChangeset for help on using the changeset viewer.