Changeset 6812
- Timestamp:
- Apr 30, 2010, 4:42:58 PM (15 years ago)
- Location:
- code/branches/dynamicmatch
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/dynamicmatch/data/levels/gametype_asteroids.oxw
r6417 r6812 138 138 139 139 140 <CheckPoint name=trigger1 position="-300,300,0" scale=1 isdestination=false isfirst=true stayactive=true distance=10 addtime=1 3/>141 142 143 <CheckPoint name=trigger2 position="2200,600,0" scale=3 isdestination=false stayactive=true distance=100 addtime=1 0>140 <CheckPoint name=trigger1 position="-300,300,0" scale=1 isdestination=false isfirst=true stayactive=true distance=10 addtime=14 /> 141 142 143 <CheckPoint name=trigger2 position="2200,600,0" scale=3 isdestination=false stayactive=true distance=100 addtime=11> 144 144 <events> 145 145 <activity> -
code/branches/dynamicmatch/src/orxonox/controllers/ArtificialController.cc
r6686 r6812 249 249 if (dynamic) 250 250 { 251 if (dynamic->notEnoughPigs||dynamic->notEnoughKillers||dynamic->notEnoughChasers) {return false;} 252 251 253 if (entity1->getPlayer()) 252 254 team1 = dynamic->getParty(entity1->getPlayer()); … … 254 256 if (entity2->getPlayer()) 255 257 team2 = dynamic->getParty(entity2->getPlayer()); 256 } 257 258 return (team1 == team2 && team1 != -1)&&(!dynamic->onlyChasers); //returns false if players are in the same party and there is a victim 259 } //-> if there is no victim or the AI-Player is not in the same team the AI attacks 258 if (team1 ==-1 ||team2 ==-1 ) {return false;} 259 else if (team1 == dynamic->chaser && team2 != dynamic->chaser) {return false;} 260 else if (team1 == dynamic->piggy && team2 == dynamic->chaser) {return false;} 261 else if (team1 == dynamic->killer && team2 == dynamic->chaser) {return false;} 262 else return true; 263 264 } 265 266 return (team1 == team2 && team1 != -1); 267 } 260 268 } -
code/branches/dynamicmatch/src/orxonox/gametypes/Dynamicmatch.cc
r6697 r6812 26 26 * 27 27 */ 28 28 //TODO: killers integrieren ; ArtificialController anpassen); 29 //pig punkte vergeben pro Zeit! 30 //killerfarbe schwarz; evtl. eigenes Raumfahrzeug; 31 //Low; Codeoptimierung und Dokumentation 32 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 */ 29 46 #include "Dynamicmatch.h" 30 47 … … 47 64 { 48 65 RegisterObject(Dynamicmatch); 49 50 66 this->gameTime_ = 180; 67 this->setConfigValues(); 51 68 this->chaser=0; 52 this->piggy=1; 53 this->onlyChasers=true; 54 this->gameEnded_ =false; 55 this->timesequence_ = static_cast<int>(this->gameTime_); 56 this->friendlyfire=true; 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; 57 82 } 58 83 59 84 void Dynamicmatch::setConfigValues() 60 85 { 61 SetConfigValue(gameTime_, 180);//just for test cases 62 SetConfigValue(friendlyfire, true); 63 static ColourValue colours[] = 64 { 65 ColourValue(0.3f, 0.3f, 1.0f), 66 ColourValue(1.0f, 0.3f, 0.3f) 86 SetConfigValue(gameTime_, 180); 87 SetConfigValue(friendlyfire, true); 88 SetConfigValue(tutorial, true); 89 static ColourValue colours[] = 90 { 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 67 94 68 95 }; … … 72 99 } 73 100 74 void Dynamicmatch::setPlayerColour(PlayerInfo* player) // not sure if this is the right place - helper function 75 { 76 std::map<PlayerInfo*, int>::const_iterator it_player = this->playerParty_.find(player); 77 Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity()); 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) 112 { 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 121 { 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); 128 } 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); 138 } 139 std::string message5("First victim.");// for testing purposes 140 COUT(0) << message5 << std::endl; 141 Host::Broadcast(message5); 142 } 143 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 } 164 165 //Case: chaser vs. killer 166 else if ((source == killer && target == chaser)||(target == killer && source == chaser )) 167 { 168 return true; 169 } 170 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()) 176 { 177 it->second.frags_++; 178 } 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); 190 191 //party switch -> colour switch 192 setPlayerColour(victim->getPlayer()); //victim colour 193 setPlayerColour(originator->getPlayer());//originator colour 194 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 } 203 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; 210 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()) 219 { 220 it->second.frags_--; 221 } 222 } 223 }// from far far away not to be removed! 224 return false; //default: no damage 225 } 226 227 228 229 bool Dynamicmatch::allowPawnDeath(Pawn* victim, Pawn* originator) 230 { 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()) 239 { 240 it->second.frags_+=20; //value must be tested 241 } 242 } 243 return true; 244 } 245 else return false; 246 } 247 248 void Dynamicmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) //set party + colouring 249 { 250 if (!player) 251 return; 252 253 Dynamicmatch::setPlayerColour(player); //Set playercolour 254 evaluatePlayerParties(); 255 } 256 257 void Dynamicmatch::playerEntered(PlayerInfo* player) //standardfunction 258 { 259 if (!player)// only for safety 260 return; 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); 263 Gametype::playerEntered(player); 264 const std::string& message6 = player->getName() + " entered the game"; 265 COUT(0) << message6 << std::endl; 266 Host::Broadcast(message6); 267 } 268 269 bool Dynamicmatch::playerLeft(PlayerInfo* player) //standardfunction 270 { 271 bool valid_player = Gametype::playerLeft(player); 272 if (valid_player) 273 { 274 switch (playerParty_[player]) 275 { 276 case 0: numberOf[chaser]--; break; 277 case 1: numberOf[piggy]--; break; 278 case 2: numberOf[killer]--; break; 279 } 280 const std::string& message = player->getName() + " left the game"; 281 COUT(0) << message << std::endl; 282 Host::Broadcast(message); 283 //remove player from map 284 playerParty_.erase (player); 285 //adjust player parties 286 evaluatePlayerParties(); 287 } 288 289 return valid_player; 290 } 291 292 293 294 295 296 void Dynamicmatch::tick(float dt) 297 { 298 SUPER(Dynamicmatch, tick, dt);//TODO - was bedeutet diese Zeile 299 300 if (this->hasStarted() && !gameEnded_) 301 { pointsPerTime =pointsPerTime + dt; 302 gameTime_ = gameTime_ - dt; 303 if (pointsPerTime > 5) 304 { 305 pointsPerTime=0.0f; 306 307 } 308 if (gameTime_<= 0) 309 { 310 this->gameEnded_ = true; 311 this->end(); 312 } 313 if ( gameTime_ <= timesequence_ && gameTime_ > 0) 314 { 315 const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!"; 316 317 this->gtinfo_->sendAnnounceMessage(message); 318 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 } 333 } 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()); 78 345 if (pawn) 79 346 { … … 83 350 for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it) 84 351 { 85 if ((*it)->isA(Class(TeamColourable))) //not sure if this works352 if ((*it)->isA(Class(TeamColourable))) 86 353 { 87 354 TeamColourable* tc = orxonox_cast<TeamColourable*>(*it); … … 90 357 } 91 358 } 92 }93 94 95 int Dynamicmatch::getParty(PlayerInfo* player) // helper function for ArtificialController96 {97 return this->playerParty_[player];98 }99 100 101 bool Dynamicmatch::allowPawnDamage(Pawn* victim, Pawn* originator)//tested - works fine102 {103 104 if (victim && victim->getPlayer())105 {106 //Case 1: a chaser hits piggy // BUG: playerParty_[originator->getPlayer()]==chaser) is true even if victim is a chaser107 if ((!onlyChasers)&&(playerParty_[originator->getPlayer()]==chaser)&&playerParty_[victim->getPlayer()]==piggy) {108 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());109 if (it != this->players_.end())110 {111 it->second.frags_++;112 }113 }114 //Case 2: piggy hits chaser115 else if ((!onlyChasers)&&(playerParty_[originator->getPlayer()]==piggy)){116 //partyswitch: victim bcomes piggy and the orginator(piggy) becomes chaser117 playerParty_[victim->getPlayer()]=piggy;118 playerParty_[originator->getPlayer()]=chaser;119 //announce120 const std::string& messageVictim = victim->getPlayer()->getName() + " is victim";121 COUT(0) << messageVictim << std::endl;122 Host::Broadcast(messageVictim);123 124 //party switch -> colour switch125 setPlayerColour(victim->getPlayer()); //victim colour126 setPlayerColour(originator->getPlayer());//orginator colour127 128 //Give new pig boost129 SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);130 if (spaceship && spaceship->getEngine())131 {132 spaceship->getEngine()->setSpeedFactor(5);133 WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine());134 new Timer(10, false, &createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this))->setDefaultValue(0, ptr), true);135 }136 137 }138 //Case 3: there are only chasers -> new piggy is needed139 else if (onlyChasers){140 //Rollenzuweisung victim wird piggy141 playerParty_[victim->getPlayer()]=piggy;142 onlyChasers=false;143 setPlayerColour(victim->getPlayer()); //victim colour144 145 //Give new pig boost146 SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);147 if (spaceship && spaceship->getEngine())148 {149 spaceship->getEngine()->setSpeedFactor(5);150 WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine());151 new Timer(10, false, &createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this))->setDefaultValue(0, ptr), true);152 }153 154 155 std::string message("First victim.");156 COUT(0) << message << std::endl;157 Host::Broadcast(message);158 }159 else if (friendlyfire)160 {161 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer());162 if (it != this->players_.end())163 {164 it->second.frags_--;165 }166 }167 }168 169 return false;170 }171 172 void Dynamicmatch::resetSpeedFactor(WeakPtr<Engine>* ptr)173 {174 if (*ptr)175 {176 (*ptr)->setSpeedFactor(1.0f);177 359 } 178 delete ptr; 179 } 180 181 bool Dynamicmatch::allowPawnDeath(Pawn* victim, Pawn* originator)// 182 { 183 return false; 184 } 185 186 void Dynamicmatch::start() 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() 187 404 { 188 405 Gametype::start(); 189 190 std::string message("Don't be a victim!"); 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!"); 191 424 COUT(0) << message << std::endl; 192 425 Host::Broadcast(message); 193 194 } 195 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 } 196 435 void Dynamicmatch::end() 197 436 { 198 437 Gametype::end(); 199 438 200 std::string message("Time out. Press F2 to see the soreboard");439 std::string message("Time out. Press F2 to see the points you scored."); 201 440 COUT(0) << message << std::endl; 202 441 Host::Broadcast(message); … … 213 452 } 214 453 215 216 void Dynamicmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) //set party + colouring217 {218 if (!player)219 return;220 playerParty_[player]=chaser;//playerparty221 Dynamicmatch::setPlayerColour(player); //Set playercolour222 }223 224 void Dynamicmatch::playerEntered(PlayerInfo* player) //standardfunction225 {226 227 if (!player)// only for safety228 return;229 230 Gametype::playerEntered(player);231 232 const std::string& message = player->getName() + " entered the game";233 COUT(0) << message << std::endl;234 Host::Broadcast(message);235 }236 237 bool Dynamicmatch::playerLeft(PlayerInfo* player) //standardfunction238 {239 bool valid_player = Gametype::playerLeft(player);240 241 242 if (valid_player)243 {244 const std::string& message = player->getName() + " left the game";245 COUT(0) << message << std::endl;246 Host::Broadcast(message);247 //remove player from map248 playerParty_.erase (player);249 }250 251 return valid_player;252 }253 254 bool Dynamicmatch::playerChangedName(PlayerInfo* player) //standardfunction255 {256 bool valid_player = Gametype::playerChangedName(player);257 258 if (valid_player)259 {260 const std::string& message = player->getOldName() + " changed name to " + player->getName();261 COUT(0) << message << std::endl;262 Host::Broadcast(message);263 }264 265 return valid_player;266 }267 268 269 270 void Dynamicmatch::tick(float dt)271 {272 SUPER(Dynamicmatch, tick, dt);//TODO - was bedeutet diese Zeile273 274 if (this->hasStarted() && !gameEnded_)275 {276 gameTime_ = gameTime_ - dt;277 if (gameTime_<= 0)278 {279 this->gameEnded_ = true;280 this->end();281 }282 if ( gameTime_ <= timesequence_ && gameTime_ > 0)283 {284 const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!";285 286 this->gtinfo_->sendAnnounceMessage(message);287 288 if (timesequence_ >= 30 && timesequence_ <= 60)289 {290 timesequence_ = timesequence_ - 10;291 }292 else if (timesequence_ <= 30)293 {294 timesequence_ = timesequence_ - 5;295 }296 else297 {298 timesequence_ = timesequence_ - 30;299 }300 }301 }302 }303 454 } -
code/branches/dynamicmatch/src/orxonox/gametypes/Dynamicmatch.h
r6697 r6812 44 44 virtual ~Dynamicmatch() {} 45 45 46 bool onlyChasers; 47 int getParty(PlayerInfo* player); 48 void setPlayerColour(PlayerInfo* player);//own function 49 void setConfigValues();//done 50 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //ok - score function and management of parties 51 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //ok - simple 46 bool notEnoughPigs; 47 bool notEnoughKillers; 48 bool notEnoughChasers; 49 virtual void evaluatePlayerParties(); 50 int getParty(PlayerInfo* player); 51 void setPlayerColour(PlayerInfo* player);//own function 52 void setConfigValues();//done 53 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //ok - score function and management of parties 54 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //ok - simple 52 55 virtual void start(); 53 56 virtual void end(); //Wie geht das mit der Punkteausgabe aendern? Z.B: Persoenliche Nachricht? 57 virtual void playerEntered(PlayerInfo* player); 58 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);//is used to initialize the player's party and colour 59 virtual bool playerLeft(PlayerInfo* player); 60 virtual bool playerChangedName(PlayerInfo* player);//unchanged 61 virtual void instructions(); 62 virtual void furtherInstructions(); 63 virtual void rewardPig(); 64 void resetSpeedFactor(WeakPtr<Engine>* ptr); 65 void tick (float dt);// used to end the game 66 //three different parties TODO const machen! 67 int chaser; 68 int piggy; 69 int killer; 70 71 bool friendlyfire; //goal: player can switch it on/off 72 bool tutorial; //goal: new players recieve messages how the new gametype works - later it can be switched off. 73 protected: 54 74 55 virtual void end(); //Wie geht das mit der Punkteausgabe? frags als Schnittstelle ausreichend? 56 virtual void playerEntered(PlayerInfo* player); 57 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);//is used to initialize the player's party and colour 58 virtual bool playerLeft(PlayerInfo* player);//ToDo: extract the player's party record - done? 59 virtual bool playerChangedName(PlayerInfo* player);//unchanged 60 61 void resetSpeedFactor(WeakPtr<Engine>* ptr); 62 63 64 void tick (float dt);// used to end the game 65 66 //inline const ColourValue& getPlayerColour(int teamnr) const 67 //{ return this->partyColours_[teamnr]; } 68 69 protected: 70 //the two different parties 71 int chaser; 72 int piggy; 73 std::map< PlayerInfo*, int > playerParty_; //player's parties are recorded here 74 std::vector<ColourValue> partyColours_; //aus TeamDeathmatch 75 bool friendlyfire; //goal: player can switch it on/off 76 float gameTime_; // from UnderAttack 77 bool gameEnded_; // true if game is over 78 int timesequence_; //used for countdown 75 76 std::map< PlayerInfo*, int > playerParty_; //player's parties are recorded here 77 std::vector<ColourValue> partyColours_; //aus TeamDeathmatch 78 unsigned int numberOf[3]; //array to count number of chasers, pigs, killers 79 float pointsPerTime; 80 float gameTime_; // from UnderAttack better: use gametype interface!!! 81 bool gameEnded_; // true if game is over 82 int timesequence_; //used for countdown 83 Timer callInstructions_; 79 84 }; 80 85 }
Note: See TracChangeset
for help on using the changeset viewer.