- Timestamp:
- May 26, 2011, 10:03:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.cc
r8552 r8616 32 32 #include "core/XMLPort.h" 33 33 #include "SpaceRace.h" 34 #include "util/Convert.h" 34 35 35 36 namespace orxonox … … 47 48 this->bTimeLimit_ = 0; 48 49 49 this->setRadarObjectColour(ColourValue:: Red);50 this->setRadarObjectShape(RadarViewable:: Dot);50 this->setRadarObjectColour(ColourValue::Blue); 51 this->setRadarObjectShape(RadarViewable::Triangle); 51 52 this->setRadarVisibility(false); 52 53 } … … 63 64 if (this->getCheckpointIndex() == gametype->getCheckpointsReached()) this->setRadarVisibility(true); 64 65 else this->setRadarVisibility(false); 65 66 if (this->bTimeLimit_ != 0 && gametype->getTimerIsActive()) {67 float time = gametype->getTime() - this->bTimeLimit_;68 if (time > 0) {69 gametype->timeIsUp();70 gametype->end();71 }72 }73 66 } 74 67 … … 92 85 if (this->getCheckpointIndex() == gametype->getCheckpointsReached() && bIsTriggered) 93 86 { 94 if (this->getLast()) 87 gametype->clock_->capture(); 88 float time = gametype->clock_->getSecondsPrecise(); 89 if (this->bTimeLimit_!=0 && time > this->bTimeLimit_) { 90 gametype->timeIsUp(); 91 gametype->end(); 92 } 93 else if (this->getLast()) 95 94 { 96 95 gametype->end(); … … 105 104 } 106 105 106 void RaceCheckPoint::setTimelimit(float timeLimit) 107 { 108 this->bTimeLimit_ = timeLimit; 109 if (this->bTimeLimit_ != 0) 110 { 111 SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get()); 112 if (gametype) 113 { 114 const std::string& message = "You have " + multi_cast<std::string>(this->bTimeLimit_) 115 + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1) + "\n"; 116 COUT(0) << message; 117 const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message); 118 } 119 } 120 } 121 107 122 }
Note: See TracChangeset
for help on using the changeset viewer.