Changeset 10368 for code/branches/towerdefenseFS15/src/modules/towerdefense
- Timestamp:
- Apr 16, 2015, 4:24:41 PM (10 years ago)
- Location:
- code/branches/towerdefenseFS15/src/modules/towerdefense
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFS15/src/modules/towerdefense/CMakeLists.txt
r10319 r10368 7 7 TDCoordinate.cc 8 8 TowerDefenseEnemy.cc 9 # TowerDefenseSelecter.cc 9 10 10 11 ) -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefense.cc
r10351 r10368 98 98 RegisterUnloadableClass(TowerDefense); 99 99 100 TowerDefense::TowerDefense(Context* context) : Deathmatch(context)100 TowerDefense::TowerDefense(Context* context) : TeamDeathmatch(context) 101 101 { 102 102 RegisterObject(TowerDefense); … … 108 108 }*/ 109 109 110 selectedPos = new TDCoordinate(0,0); 111 // TowerDefenseSelecter Selecter = new TowerDefenseSelecter(); 110 112 111 113 112 114 this->setHUDTemplate("TowerDefenseHUD"); 115 this->nextwaveTimer_.setTimer(10, false, createExecutor(createFunctor(&TowerDefense::nextwave, this))); 116 this->nextwaveTimer_.stopTimer(); 117 this->waves_ = 0; 118 this->time = 0; 119 this->credit_ = 0; 120 this->lifes_ = 0; 113 121 114 122 //this->stats_ = new TowerDefensePlayerStats(); … … 138 146 { 139 147 140 Deathmatch::start();148 TeamDeathmatch::start(); 141 149 142 150 // Waypoints: [1,3] [10,3] [10,11] [13,11] -> add the points to a matrix so the player cant place towers on the path … … 220 228 { 221 229 222 Deathmatch::end();230 TeamDeathmatch::end(); 223 231 ChatManager::message("Match is over! Gameover!"); 224 232 … … 330 338 std::vector<TDCoordinate*> path; 331 339 path.push_back(coord1); 332 if(time> 1&& TowerDefenseEnemyvector.size() < 30)340 if(time>=TowerDefenseEnemyvector.size() && TowerDefenseEnemyvector.size() < 30) 333 341 { 334 342 //adds different types of enemys depending on the WaveNumber 335 343 addTowerDefenseEnemy(path, this->getWaveNumber() % 3 +1 ); 336 time = time-1;337 344 } 338 345 … … 359 366 } 360 367 } 368 361 369 //goes thorugh vector to see if an enemy is still alive. if not next wave is launched 362 370 int count= 0; … … 369 377 } 370 378 379 if (count == 0 && !this->nextwaveTimer_.isActive()) 380 this->nextwaveTimer_.startTimer(); 381 382 /* time2 +=dt; 371 383 if(count== 0) 372 384 { 373 time2 +=dt;374 385 if(time2 > 10) 375 386 { … … 380 391 } 381 392 } 382 393 */ 383 394 384 395 } … … 425 436 void TowerDefense::playerEntered(PlayerInfo* player) 426 437 { 427 Deathmatch::playerEntered(player);438 TeamDeathmatch::playerEntered(player); 428 439 429 440 const std::string& message = player->getName() + " entered the game"; … … 433 444 bool TowerDefense::playerLeft(PlayerInfo* player) 434 445 { 435 bool valid_player = Deathmatch::playerLeft(player);446 bool valid_player = TeamDeathmatch::playerLeft(player); 436 447 437 448 if (valid_player) … … 463 474 } 464 475 465 Deathmatch::pawnKilled(victim, killer);476 TeamDeathmatch::pawnKilled(victim, killer); 466 477 } 467 478 -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefense.h
r10351 r10368 39 39 #include "TDCoordinate.h" 40 40 #include "towerdefense/TowerDefensePrereqs.h" 41 #include "gametypes/ Deathmatch.h"41 #include "gametypes/TeamDeathmatch.h" 42 42 #include "TowerDefenseEnemy.h" 43 43 #include "util/Output.h" … … 46 46 namespace orxonox 47 47 { 48 class _TowerDefenseExport TowerDefense : public Deathmatch48 class _TowerDefenseExport TowerDefense : public TeamDeathmatch 49 49 { 50 50 public: … … 70 70 void buyTower(int cost){ credit_ -= cost;} 71 71 void addCredit(int credit) { credit_+=credit; } 72 void nextwave(){ waves_++;}72 void nextwave(){ TowerDefenseEnemyvector.clear(); waves_++; time=0;} 73 73 int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; } 74 TDCoordinate* selectedPos; 74 75 75 76 //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); … … 95 96 TowerDefenseCenterpoint *center_; 96 97 float time; 97 float time2;98 // float time2; 98 99 int credit_; 99 100 int waves_; 100 101 int lifes_; 102 Timer nextwaveTimer_; 101 103 102 104 /* handles stats */
Note: See TracChangeset
for help on using the changeset viewer.