Changeset 11857 for code/branches/RacingBots_FS18/src/modules
- Timestamp:
- Apr 12, 2018, 4:09:58 PM (7 years ago)
- Location:
- code/branches/RacingBots_FS18/src/modules/gametypes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.cc
r11841 r11857 119 119 120 120 this->spawnPlayersIfRequested(); 121 this->countdown_mode=true; 121 122 this->cantMove_ = true; 122 123 //players are unable to move while countdown is running … … 145 146 ChatManager::message(message); 146 147 147 148 /*for(int i=10; i>0;i=i-1){ 149 startmessage(i); 150 }*/ 151 152 153 //after 11 seconds , countdownFinished function is called to activate bots` engines 154 //Timer* countdownTimer = new Timer(); 155 //countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this))); 156 157 /* 158 while(countdownTimer->getRemainingTime()!=0){ 159 if(countdownTimer->getRemainingTime()==1){ 160 startmessage(1); 161 } 162 }*/ 163 164 165 166 167 168 169 170 /*unsigned long long float time_notification=countdownTimer.getRealMicroSeconds(); 171 while(this->bTimeIsUp_==false){ 172 173 std::ostream stream; 174 stream<<time_notification; 175 std::string chat_notification(stream.str()); 176 this->getGametypeInfo()->sendAnnounceMessage(chat_notification); 177 ChatManager::message(chat_notification); 178 179 }*/ 180 181 182 } 183 184 185 148 149 150 151 } 152 153 // Counter in the beginning of the game 186 154 void SpaceRace::tick(float dt) { 187 155 SUPER(SpaceRace, tick, dt); 188 this->time_passed -= dt;189 156 157 //countdown_mode is set true,when spawnIfRequested is called 190 158 if (countdown_mode) { 159 //10 seconds will be counted 160 this->time_passed -= dt; 191 161 192 162 //orxout() << "time: " <<(int) time_passed << "s" << endl; 163 193 164 std::string message=std::to_string((int)time_passed); 194 165 this->getGametypeInfo()->sendAnnounceMessage(message); 195 166 if (time_passed <= 1) { 167 196 168 this->countdownFinished(); 197 169 this->countdown_mode = false; … … 210 182 211 183 } 212 213 184 214 185 void SpaceRace::end() -
code/branches/RacingBots_FS18/src/modules/gametypes/SpaceRace.h
r11841 r11857 86 86 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator) override; 87 87 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator) override; 88 bool countdown_mode = true;89 float time_passed = 11.0f;88 bool countdown_mode = false; 89 float time_passed = 4.0f; 90 90 91 91 private:
Note: See TracChangeset
for help on using the changeset viewer.