[6586] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Johannes Ritz |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
[6812] | 28 | //TODO: killers integrieren ; ArtificialController anpassen); |
---|
| 29 | //pig punkte vergeben pro Zeit! |
---|
| 30 | //killerfarbe schwarz; evtl. eigenes Raumfahrzeug; |
---|
| 31 | //Low; Codeoptimierung und Dokumentation |
---|
[6586] | 32 | |
---|
[6812] | 33 | /* |
---|
| 34 | short gaming manual: |
---|
| 35 | There are three different parties a player can belong to: victim, chaser or killer |
---|
| 36 | Every player starts as chaser. As long as there are not enough victims and killers, you can change your and other player's parties by shooting them. |
---|
| 37 | In order to win you have to earn as much points as possible: |
---|
| 38 | - as victim by escaping the chasers |
---|
| 39 | - as chaser by shooting the victim |
---|
| 40 | - as killer by killing the chasers |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | What you shouldn't do is shooting at players of your own party. By doing so your score will decrease. |
---|
| 44 | P.S: If you don't want to be a victim: Get rid of your part by shooting a chaser. |
---|
| 45 | */ |
---|
[6586] | 46 | #include "Dynamicmatch.h" |
---|
| 47 | |
---|
[6686] | 48 | #include "util/Convert.h" |
---|
[6586] | 49 | #include "core/CoreIncludes.h" |
---|
| 50 | #include "network/Host.h" |
---|
| 51 | #include "infos/PlayerInfo.h" |
---|
| 52 | #include "worldentities/pawns/Pawn.h" |
---|
[6697] | 53 | #include "worldentities/pawns/SpaceShip.h" |
---|
[6686] | 54 | #include "core/ConfigValueIncludes.h" |
---|
| 55 | #include "interfaces/TeamColourable.h" |
---|
[6697] | 56 | #include "items/Engine.h" |
---|
| 57 | #include "tools/Timer.h" |
---|
| 58 | |
---|
[6586] | 59 | namespace orxonox |
---|
| 60 | { |
---|
| 61 | CreateUnloadableFactory(Dynamicmatch); |
---|
| 62 | |
---|
| 63 | Dynamicmatch::Dynamicmatch(BaseObject* creator) : Gametype(creator) |
---|
| 64 | { |
---|
| 65 | RegisterObject(Dynamicmatch); |
---|
[6812] | 66 | this->gameTime_ = 180; |
---|
| 67 | this->setConfigValues(); |
---|
[6686] | 68 | this->chaser=0; |
---|
[6812] | 69 | this->piggy=1; |
---|
| 70 | this->killer=2; |
---|
| 71 | this->notEnoughPigs=false; |
---|
| 72 | this->notEnoughKillers=false; |
---|
| 73 | this->notEnoughChasers=false; |
---|
| 74 | this->gameEnded_ =false; |
---|
| 75 | this->timesequence_ = static_cast<int>(this->gameTime_); |
---|
| 76 | this->friendlyfire=true; |
---|
| 77 | this->numberOf[chaser]=0; |
---|
| 78 | this->numberOf[piggy]=0; |
---|
| 79 | this->numberOf[killer]=0; |
---|
| 80 | this->tutorial=true; |
---|
| 81 | this->pointsPerTime=0.0f; |
---|
[6586] | 82 | } |
---|
| 83 | |
---|
[6697] | 84 | void Dynamicmatch::setConfigValues() |
---|
| 85 | { |
---|
[6812] | 86 | SetConfigValue(gameTime_, 180); |
---|
| 87 | SetConfigValue(friendlyfire, true); |
---|
| 88 | SetConfigValue(tutorial, true); |
---|
| 89 | static ColourValue colours[] = |
---|
[6697] | 90 | { |
---|
[6812] | 91 | ColourValue(0.3f, 0.3f, 1.0f), //chasercolour |
---|
| 92 | ColourValue(1.0f, 0.3f, 0.3f), //piggycolour |
---|
| 93 | ColourValue(0.3f, 1.0f, 0.3f) //killercolour what about black: 0.0f, 0.0f, 0.0f |
---|
[6697] | 94 | |
---|
| 95 | }; |
---|
| 96 | static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue)); |
---|
| 97 | |
---|
| 98 | SetConfigValue(partyColours_, defaultcolours); |
---|
| 99 | } |
---|
| 100 | |
---|
[6812] | 101 | bool Dynamicmatch::allowPawnDamage(Pawn* victim, Pawn* originator)//tested - works fine |
---|
| 102 | { |
---|
| 103 | if (!originator||!victim) |
---|
| 104 | {return false;} |
---|
| 105 | if (victim && victim->getPlayer()) //&& originator && originator->getPlayer() ?? |
---|
| 106 | { |
---|
| 107 | int target= playerParty_[victim->getPlayer()]; |
---|
| 108 | int source= playerParty_[originator->getPlayer()]; |
---|
| 109 | |
---|
| 110 | //Case: Not Enough Pigs: party change (= party management) |
---|
| 111 | if (notEnoughPigs) |
---|
[6686] | 112 | { |
---|
[6812] | 113 | |
---|
| 114 | numberOf[target]--; //decrease numberof victims's party |
---|
| 115 | const std::string& message = std::string(" Chasers ") + multi_cast<std::string>(numberOf[chaser]); COUT(0) << message << std::endl; Host::Broadcast(message); |
---|
| 116 | playerParty_[victim->getPlayer()]=piggy; //victim's new party: pig |
---|
| 117 | setPlayerColour(victim->getPlayer()); //victim's new colour |
---|
| 118 | numberOf[piggy]++; //party switch: number of players is not affected (decrease and increase) |
---|
| 119 | const std::string& message1 = std::string(" Pig") + multi_cast<std::string>(numberOf[piggy]); COUT(0) << message1 << std::endl; Host::Broadcast(message1); |
---|
| 120 | if (notEnoughKillers) //reward the originator |
---|
[6686] | 121 | { |
---|
[6812] | 122 | numberOf[source]--; //decrease numberof originator's party |
---|
| 123 | const std::string& message = std::string(" Chasers ") + multi_cast<std::string>(numberOf[chaser]); COUT(0) << message << std::endl; Host::Broadcast(message); |
---|
| 124 | playerParty_[originator->getPlayer()]=killer; //originator's new party: killer |
---|
| 125 | setPlayerColour(originator->getPlayer()); //originator's new colour |
---|
| 126 | numberOf[killer]++; |
---|
| 127 | const std::string& message2 = std::string(" Killers ") + multi_cast<std::string>(numberOf[killer]); COUT(0) << message2 << std::endl; Host::Broadcast(message2); |
---|
[6686] | 128 | } |
---|
[6812] | 129 | evaluatePlayerParties(); //check if the party change has to trigger futher party changes |
---|
| 130 | |
---|
| 131 | //Give new pig boost |
---|
| 132 | SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim); |
---|
| 133 | if (spaceship && spaceship->getEngine()) |
---|
| 134 | { |
---|
| 135 | spaceship->getEngine()->setSpeedFactor(5); |
---|
| 136 | WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine()); |
---|
| 137 | new Timer(10, false, &createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this))->setDefaultValue(0, ptr), true); |
---|
[6686] | 138 | } |
---|
[6812] | 139 | std::string message5("First victim.");// for testing purposes |
---|
| 140 | COUT(0) << message5 << std::endl; |
---|
| 141 | Host::Broadcast(message5); |
---|
[6686] | 142 | } |
---|
[6586] | 143 | |
---|
[6812] | 144 | //Case: notEnoughKillers: party change |
---|
| 145 | else if (notEnoughKillers) |
---|
| 146 | { |
---|
| 147 | numberOf[target]--; //decrease numberof victims's party |
---|
| 148 | playerParty_[victim->getPlayer()]=killer; //victim's new party: killer |
---|
| 149 | setPlayerColour(victim->getPlayer()); //victim colour |
---|
| 150 | numberOf[killer]++; //party switch: number of players is not affected (decrease and increase) |
---|
| 151 | const std::string& message = std::string(" Killers ") + multi_cast<std::string>(numberOf[killer]); COUT(0) << message << std::endl; Host::Broadcast(message); |
---|
| 152 | evaluatePlayerParties(); //check if the party change has to trigger futher party changes |
---|
| 153 | } |
---|
| 154 | //Case: notEnoughChasers: party change |
---|
| 155 | else if (notEnoughChasers) |
---|
| 156 | { |
---|
| 157 | numberOf[target]--; //decrease numberof victims's party |
---|
| 158 | playerParty_[victim->getPlayer()]=chaser; //victim's new party: chaser |
---|
| 159 | setPlayerColour(victim->getPlayer()); //victim colour |
---|
| 160 | numberOf[chaser]++; //party switch: number of players is not affected (decrease and increase) |
---|
| 161 | const std::string& message = std::string(" Chasers ") + multi_cast<std::string>(numberOf[chaser]); COUT(0) << message << std::endl; Host::Broadcast(message); |
---|
| 162 | evaluatePlayerParties(); //check if the party change has to trigger futher party changes |
---|
| 163 | } |
---|
[6586] | 164 | |
---|
[6812] | 165 | //Case: chaser vs. killer |
---|
| 166 | else if ((source == killer && target == chaser)||(target == killer && source == chaser )) |
---|
| 167 | { |
---|
| 168 | return true; |
---|
| 169 | } |
---|
[6586] | 170 | |
---|
[6812] | 171 | //Case: a chaser hits piggy |
---|
| 172 | else if ((source==chaser)&&(target==piggy)) |
---|
| 173 | { |
---|
| 174 | std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer()); |
---|
| 175 | if (it != this->players_.end()) |
---|
[6686] | 176 | { |
---|
| 177 | it->second.frags_++; |
---|
| 178 | } |
---|
[6812] | 179 | } |
---|
| 180 | //Case: piggy hits chaser |
---|
| 181 | else if (source==piggy&&target==chaser) |
---|
| 182 | { |
---|
| 183 | //partyswitch: victim bcomes piggy and the originator(piggy) becomes chaser |
---|
| 184 | playerParty_[victim->getPlayer()]=piggy; |
---|
| 185 | playerParty_[originator->getPlayer()]=chaser; |
---|
| 186 | //announce |
---|
| 187 | const std::string& messageVictim = victim->getPlayer()->getName() + " is victim"; |
---|
| 188 | COUT(0) << messageVictim << std::endl; |
---|
| 189 | Host::Broadcast(messageVictim); |
---|
[6697] | 190 | |
---|
[6812] | 191 | //party switch -> colour switch |
---|
| 192 | setPlayerColour(victim->getPlayer()); //victim colour |
---|
| 193 | setPlayerColour(originator->getPlayer());//originator colour |
---|
[6697] | 194 | |
---|
[6812] | 195 | //Give new pig boost |
---|
| 196 | SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim); |
---|
| 197 | if (spaceship && spaceship->getEngine()) |
---|
| 198 | { |
---|
| 199 | spaceship->getEngine()->setSpeedFactor(5); |
---|
| 200 | WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine()); |
---|
| 201 | new Timer(10, false, &createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this))->setDefaultValue(0, ptr), true); |
---|
| 202 | } |
---|
[6697] | 203 | |
---|
[6812] | 204 | } |
---|
| 205 | //TODO: killer vs piggy |
---|
| 206 | else if (source==killer &&target==piggy) //party and colour switch |
---|
| 207 | { |
---|
| 208 | playerParty_[victim->getPlayer()]=killer; |
---|
| 209 | playerParty_[originator->getPlayer()]=piggy; |
---|
[6697] | 210 | |
---|
[6812] | 211 | setPlayerColour(victim->getPlayer()); //victim colour |
---|
| 212 | setPlayerColour(originator->getPlayer()); //originator colour |
---|
| 213 | } |
---|
| 214 | //Case: friendly fire |
---|
| 215 | else if (friendlyfire && (source == target)) |
---|
| 216 | { |
---|
| 217 | std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer()); |
---|
| 218 | if (it != this->players_.end()) |
---|
[6686] | 219 | { |
---|
| 220 | it->second.frags_--; |
---|
| 221 | } |
---|
[6812] | 222 | } |
---|
| 223 | }// from far far away not to be removed! |
---|
| 224 | return false; //default: no damage |
---|
[6686] | 225 | } |
---|
[6586] | 226 | |
---|
[6686] | 227 | |
---|
| 228 | |
---|
[6812] | 229 | bool Dynamicmatch::allowPawnDeath(Pawn* victim, Pawn* originator) |
---|
[6686] | 230 | { |
---|
[6812] | 231 | //killers can kill chasers and killers can be killed by chasers |
---|
| 232 | if ((playerParty_[originator->getPlayer()] == killer && playerParty_[victim->getPlayer()] == chaser)||(playerParty_[victim->getPlayer()] == killer && |
---|
| 233 | playerParty_[originator->getPlayer()] == chaser )) |
---|
| 234 | { |
---|
| 235 | if (playerParty_[originator->getPlayer()] == killer) //reward the killer |
---|
| 236 | { |
---|
| 237 | std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer()); |
---|
| 238 | if (it != this->players_.end()) |
---|
[6686] | 239 | { |
---|
[6812] | 240 | it->second.frags_+=20; //value must be tested |
---|
| 241 | } |
---|
| 242 | } |
---|
| 243 | return true; |
---|
| 244 | } |
---|
| 245 | else return false; |
---|
[6586] | 246 | } |
---|
[6686] | 247 | |
---|
[6812] | 248 | void Dynamicmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) //set party + colouring |
---|
[6586] | 249 | { |
---|
[6686] | 250 | if (!player) |
---|
| 251 | return; |
---|
[6812] | 252 | |
---|
| 253 | Dynamicmatch::setPlayerColour(player); //Set playercolour |
---|
| 254 | evaluatePlayerParties(); |
---|
[6686] | 255 | } |
---|
| 256 | |
---|
[6692] | 257 | void Dynamicmatch::playerEntered(PlayerInfo* player) //standardfunction |
---|
[6686] | 258 | { |
---|
[6812] | 259 | if (!player)// only for safety |
---|
[6686] | 260 | return; |
---|
[6812] | 261 | playerParty_[player]=chaser; //Set playerparty |
---|
| 262 | numberOf[chaser]++; const std::string& message = std::string(" Chasers ") + multi_cast<std::string>(numberOf[chaser]); COUT(0) << message << std::endl; Host::Broadcast(message); |
---|
[6586] | 263 | Gametype::playerEntered(player); |
---|
[6812] | 264 | const std::string& message6 = player->getName() + " entered the game"; |
---|
| 265 | COUT(0) << message6 << std::endl; |
---|
| 266 | Host::Broadcast(message6); |
---|
[6586] | 267 | } |
---|
| 268 | |
---|
[6686] | 269 | bool Dynamicmatch::playerLeft(PlayerInfo* player) //standardfunction |
---|
[6586] | 270 | { |
---|
| 271 | bool valid_player = Gametype::playerLeft(player); |
---|
| 272 | if (valid_player) |
---|
| 273 | { |
---|
[6812] | 274 | switch (playerParty_[player]) |
---|
| 275 | { |
---|
| 276 | case 0: numberOf[chaser]--; break; |
---|
| 277 | case 1: numberOf[piggy]--; break; |
---|
| 278 | case 2: numberOf[killer]--; break; |
---|
| 279 | } |
---|
[6586] | 280 | const std::string& message = player->getName() + " left the game"; |
---|
| 281 | COUT(0) << message << std::endl; |
---|
| 282 | Host::Broadcast(message); |
---|
[6686] | 283 | //remove player from map |
---|
[6812] | 284 | playerParty_.erase (player); |
---|
| 285 | //adjust player parties |
---|
| 286 | evaluatePlayerParties(); |
---|
[6586] | 287 | } |
---|
| 288 | |
---|
| 289 | return valid_player; |
---|
| 290 | } |
---|
| 291 | |
---|
[6812] | 292 | |
---|
[6586] | 293 | |
---|
[6686] | 294 | |
---|
| 295 | |
---|
[6812] | 296 | void Dynamicmatch::tick(float dt) |
---|
[6586] | 297 | { |
---|
[6686] | 298 | SUPER(Dynamicmatch, tick, dt);//TODO - was bedeutet diese Zeile |
---|
| 299 | |
---|
| 300 | if (this->hasStarted() && !gameEnded_) |
---|
[6812] | 301 | { pointsPerTime =pointsPerTime + dt; |
---|
[6686] | 302 | gameTime_ = gameTime_ - dt; |
---|
[6812] | 303 | if (pointsPerTime > 5) |
---|
| 304 | { |
---|
| 305 | pointsPerTime=0.0f; |
---|
| 306 | |
---|
| 307 | } |
---|
[6686] | 308 | if (gameTime_<= 0) |
---|
[6586] | 309 | { |
---|
[6686] | 310 | this->gameEnded_ = true; |
---|
| 311 | this->end(); |
---|
[6586] | 312 | } |
---|
[6812] | 313 | if ( gameTime_ <= timesequence_ && gameTime_ > 0) |
---|
[6686] | 314 | { |
---|
| 315 | const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!"; |
---|
[6586] | 316 | |
---|
[6686] | 317 | this->gtinfo_->sendAnnounceMessage(message); |
---|
[6586] | 318 | |
---|
[6686] | 319 | if (timesequence_ >= 30 && timesequence_ <= 60) |
---|
| 320 | { |
---|
| 321 | timesequence_ = timesequence_ - 10; |
---|
| 322 | } |
---|
| 323 | else if (timesequence_ <= 30) |
---|
| 324 | { |
---|
| 325 | timesequence_ = timesequence_ - 5; |
---|
| 326 | } |
---|
| 327 | else |
---|
| 328 | { |
---|
| 329 | timesequence_ = timesequence_ - 30; |
---|
| 330 | } |
---|
| 331 | } |
---|
| 332 | } |
---|
[6586] | 333 | } |
---|
[6812] | 334 | |
---|
| 335 | void Dynamicmatch::rewardPig() |
---|
| 336 | { |
---|
| 337 | //durch alle Spieler iterieren |
---|
| 338 | // allen Spielern mit der Pig-party frags++ |
---|
| 339 | ; |
---|
| 340 | } |
---|
| 341 | void Dynamicmatch::setPlayerColour(PlayerInfo* player) // sets a players colour |
---|
| 342 | { |
---|
| 343 | std::map<PlayerInfo*, int>::const_iterator it_player = this->playerParty_.find(player); |
---|
| 344 | Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity()); |
---|
| 345 | if (pawn) |
---|
| 346 | { |
---|
| 347 | pawn->setRadarObjectColour(this->partyColours_[it_player->second]); //does this work? //what about playerParty_[it_player] instead of it_player->second |
---|
| 348 | |
---|
| 349 | std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects(); |
---|
| 350 | for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it) |
---|
| 351 | { |
---|
| 352 | if ((*it)->isA(Class(TeamColourable))) |
---|
| 353 | { |
---|
| 354 | TeamColourable* tc = orxonox_cast<TeamColourable*>(*it); |
---|
| 355 | tc->setTeamColour(this->partyColours_[it_player->second]); |
---|
| 356 | } |
---|
| 357 | } |
---|
| 358 | } |
---|
| 359 | } |
---|
| 360 | |
---|
| 361 | void Dynamicmatch::evaluatePlayerParties() //manages the notEnough booleans (here the percentage of special players is implemented) |
---|
| 362 | { |
---|
| 363 | //pigs: 1 + every 6th player is a pig |
---|
| 364 | if ( (1+this->getNumberOfPlayers()/6) > numberOf[piggy]) {notEnoughPigs=true;} |
---|
| 365 | else {notEnoughPigs=false;} |
---|
| 366 | //killers: every 4th player is a killer |
---|
| 367 | if (getNumberOfPlayers()/4 > numberOf[killer]) {notEnoughKillers=true;} |
---|
| 368 | else {notEnoughKillers=false;} |
---|
| 369 | //chasers: there are more chasers than killers + pigs |
---|
| 370 | if (numberOf[piggy]+numberOf[killer] > numberOf[chaser]) {notEnoughChasers=true;} |
---|
| 371 | else {notEnoughChasers=false; const std::string& message = "Players Evaluated";COUT(0) << message << std::endl; Host::Broadcast(message);} |
---|
| 372 | const std::string& messagetest = multi_cast<std::string>(numberOf[piggy]+numberOf[chaser]+numberOf[killer]) + " players!"; |
---|
| 373 | COUT(0) << messagetest << std::endl; Host::Broadcast(messagetest); |
---|
| 374 | } |
---|
| 375 | |
---|
| 376 | int Dynamicmatch::getParty(PlayerInfo* player) // helper function for ArtificialController |
---|
| 377 | { |
---|
| 378 | return this->playerParty_[player]; |
---|
| 379 | } |
---|
| 380 | |
---|
| 381 | void Dynamicmatch::resetSpeedFactor(WeakPtr<Engine>* ptr)// helper function |
---|
| 382 | { |
---|
| 383 | if (*ptr) |
---|
| 384 | { |
---|
| 385 | (*ptr)->setSpeedFactor(1.0f); |
---|
| 386 | } |
---|
| 387 | delete ptr; |
---|
| 388 | } |
---|
| 389 | |
---|
| 390 | bool Dynamicmatch::playerChangedName(PlayerInfo* player) //standardfunction |
---|
| 391 | { |
---|
| 392 | bool valid_player = Gametype::playerChangedName(player); |
---|
| 393 | if (valid_player) |
---|
| 394 | { |
---|
| 395 | const std::string& message = player->getOldName() + " changed name to " + player->getName(); |
---|
| 396 | COUT(0) << message << std::endl; |
---|
| 397 | Host::Broadcast(message); |
---|
| 398 | } |
---|
| 399 | |
---|
| 400 | return valid_player; |
---|
| 401 | } |
---|
| 402 | |
---|
| 403 | void Dynamicmatch::start() |
---|
| 404 | { |
---|
| 405 | Gametype::start(); |
---|
| 406 | if(!tutorial) |
---|
| 407 | { |
---|
| 408 | std::string message("Game started!"); |
---|
| 409 | COUT(0) << message << std::endl; |
---|
| 410 | Host::Broadcast(message); |
---|
| 411 | } |
---|
| 412 | else if(tutorial) //in order to explain how this gametype works briefly |
---|
| 413 | { |
---|
| 414 | std::string tutotrialmessage("Shoot at other players as long as every player is red.\n\nIf you are fast enough you're spaceship will become green.\n\nIf you are hit you'll become blue."); |
---|
| 415 | COUT(0) << tutotrialmessage << std::endl; |
---|
| 416 | Host::Broadcast(tutotrialmessage); |
---|
| 417 | callInstructions_.setTimer(10, false, createExecutor(createFunctor(&Dynamicmatch::instructions, this))); |
---|
| 418 | } |
---|
| 419 | } |
---|
| 420 | |
---|
| 421 | void Dynamicmatch::instructions() |
---|
| 422 | { |
---|
| 423 | std::string message("Earn points:\n\n\n\tIf you're red: Chase the blue player!\n\n\tIf you're blue shoot at a red player or hide.\n\n\tIf you're green: You've got the licence to kill red players!"); |
---|
| 424 | COUT(0) << message << std::endl; |
---|
| 425 | Host::Broadcast(message); |
---|
| 426 | callInstructions_.setTimer(10, false, createExecutor(createFunctor(&Dynamicmatch::furtherInstructions, this))); |
---|
| 427 | } |
---|
| 428 | |
---|
| 429 | void Dynamicmatch::furtherInstructions() |
---|
| 430 | { |
---|
| 431 | std::string message("After 3 Minutes the game is over."); |
---|
| 432 | COUT(0) << message << std::endl; |
---|
| 433 | Host::Broadcast(message); |
---|
| 434 | } |
---|
| 435 | void Dynamicmatch::end() |
---|
| 436 | { |
---|
| 437 | Gametype::end(); |
---|
| 438 | |
---|
| 439 | std::string message("Time out. Press F2 to see the points you scored."); |
---|
| 440 | COUT(0) << message << std::endl; |
---|
| 441 | Host::Broadcast(message); |
---|
| 442 | /*for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it) |
---|
| 443 | { |
---|
| 444 | if (it->first->getClientID() == CLIENTID_UNKNOWN) |
---|
| 445 | continue; |
---|
| 446 | |
---|
| 447 | if (it->second == 1) |
---|
| 448 | this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID()); |
---|
| 449 | else |
---|
| 450 | this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID()); |
---|
| 451 | }*/ |
---|
| 452 | } |
---|
| 453 | |
---|
[6586] | 454 | } |
---|