- Timestamp:
- May 12, 2011, 4:36:30 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc
r8458 r8468 47 47 * falls im XML-File keine Werte spezifiziert wurden. */ 48 48 this->setMaxDistance(3000); 49 this->setWarnDistance(2000); 50 this->setShowDistance(2500); 51 this->setHealthDecrease(1); 49 this->setWarnDistance(this->getMaxDistance()); 50 this->setShowDistance(this->getMaxDistance()); 52 51 this->setReaction(0); 53 52 … … 81 80 { 82 81 Pawn* currentPawn = *current; 83 float distance = this->computeDistance(currentPawn); 84 if(distance <= this->maxDistance_) 85 { 82 if( this->reaction_ == 0 ) 83 { 84 float distance = this->computeDistance(currentPawn); 85 if(distance <= this->maxDistance_) 86 { 87 pawnsIn_.push_back(currentPawn); 88 } 89 } else { 86 90 pawnsIn_.push_back(currentPawn); 87 91 } … … 183 187 XMLPortParam(SpaceBoundaries, "maxDistance", setMaxDistance, getMaxDistance, xmlelement, mode); 184 188 XMLPortParam(SpaceBoundaries, "warnDistance", setWarnDistance, getWarnDistance, xmlelement, mode); 189 XMLPortParam(SpaceBoundaries, "showDistance", setShowDistance, getShowDistance, xmlelement, mode); 185 190 XMLPortParam(SpaceBoundaries, "healthDecrease", setHealthDecrease, getHealthDecrease, xmlelement, mode); 186 191 XMLPortParam(SpaceBoundaries, "reactionMode", setReaction, getReaction, xmlelement, mode); … … 191 196 this->checkWhoIsIn(); 192 197 this->removeAllBillboards(); 193 COUT( 0) << "Groesse der Liste: " << (int) pawnsIn_.size() << std::endl;198 COUT(4) << "Groesse der Pawn-Liste 'SpaceBoundaries::pawnsIn_': " << (int) pawnsIn_.size() << std::endl; 194 199 195 200 float distance; … … 202 207 distance = this->computeDistance(currentPawn); 203 208 humanItem = this->isHumanPlayer(currentPawn); 204 COUT( 0) << "Distanz:" << distance << std::endl; // message for debugging209 COUT(5) << "Distanz:" << distance << std::endl; // message for debugging 205 210 if(distance > this->warnDistance_ && distance < this->maxDistance_) // Zeige Warnung an! 206 211 { 207 COUT(0) << "You are near by the boundaries!" << std::endl; // message for debugging208 212 if(humanItem) 209 213 { 210 COUT( 0) << "humanItem ist true" << std::endl;211 this->displayWarning("Attention! You are near by the boundaries!");214 COUT(5) << "humanItem ist true" << std::endl; 215 this->displayWarning("Attention! You are close to the boundary!"); 212 216 } 213 217 } 214 if( (this->maxDistance_ - distance) < this->showDistance_ )218 if( humanItem && (this->maxDistance_ - distance) < this->showDistance_ ) 215 219 { 216 220 this->displayBoundaries(currentPawn); // Zeige Grenze an! … … 220 224 if( humanItem ) 221 225 { 222 COUT( 0) << "Health should be decreasing!" << std::endl;226 COUT(5) << "Health should be decreasing!" << std::endl; 223 227 this->displayWarning("You are out of the area now!"); 224 228 } … … 269 273 /* Checke, ob das Pawn innerhalb des nächsten Ticks, das erlaubte Gebiet verlassen würde. 270 274 Falls ja: Spicke es zurück. */ 271 if( currentDistance + normalSpeed * dt > this->maxDistance_ )275 if( currentDistance + normalSpeed * dt > this->maxDistance_ - 10 ) // -10: "security measure" 272 276 { 273 277 float dampingFactor = 0.5;
Note: See TracChangeset
for help on using the changeset viewer.