Changeset 8767 for code/trunk/src/modules/objects/SpaceBoundaries.h
- Timestamp:
- Jul 20, 2011, 11:27:45 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/objects/SpaceBoundaries.h
r8706 r8767 45 45 { 46 46 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). 49 49 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 to54 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) 62 62 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. 64 64 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 @code68 <SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="0" />69 @endcode65 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 70 70 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 */ 76 75 class _ObjectsExport SpaceBoundaries : public StaticEntity, public Tickable 77 76 { … … 79 78 SpaceBoundaries(BaseObject* creator); 80 79 ~SpaceBoundaries(); 81 80 82 81 void setMaxDistance(float r); 83 82 float getMaxDistance(); 84 83 85 84 void setWarnDistance(float r); 86 85 float getWarnDistance(); 87 86 88 87 void setShowDistance(float r); 89 88 float getShowDistance(); 90 89 91 90 void setHealthDecrease(float amount); 92 91 float getHealthDecrease(); 93 92 94 93 void setReaction(int mode); 95 94 int getReaction(); 96 95 97 96 void XMLPort(Element& xmlelement, XMLPort::Mode mode); 98 97 99 98 void tick(float dt); 100 99 101 100 private: 102 101 struct BillboardAdministration{ bool usedYet; Billboard* billy; }; 103 102 104 103 // Variabeln:: 105 104 std::list<WeakPtr<Pawn> > pawnsIn_; //!< List of the pawns that this instance of SpaceBoundaries has to handle. 106 105 107 106 std::vector<BillboardAdministration> billboards_; 108 107 109 108 int reaction_; //!< Values: 0, 1, 2. 110 109 //!< 0: Reflection on boundary (Standard). … … 114 113 float warnDistance_; //!< Distance in which a warning is displayed. 115 114 float showDistance_; //!< Distance at which the boundaries are displayed. 116 115 117 116 float healthDecrease_; //!< Rate of health loss. 118 117 119 118 //RadarViewable* centerRadar_; //!< Representation of the space boundary in the radar. 120 119 121 120 // Funktionen:: 122 121 float computeDistance(WorldEntity *item); //!< Compute distance to center point. … … 126 125 void bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity); 127 126 bool isHumanPlayer(Pawn *item); 128 127 129 128 void checkWhoIsIn(); //!< Update the list 'pawnsIn_'. 130 129 131 130 void positionBillboard(const Vector3& position, float alpha); //!< Display a Billboard at the position 'position'. 132 131 void setBillboardOptions(Billboard *billy); 133 132 void removeAllBillboards(); //!< Hide all elements of '*billboard_' and set their attribute 'usedYet' to 0. 134 135 133 }; 136 134 }
Note: See TracChangeset
for help on using the changeset viewer.