Changeset 10140 for code/branches/towerdefenseHS14/src
- Timestamp:
- Nov 26, 2014, 4:30:10 PM (10 years ago)
- Location:
- code/branches/towerdefenseHS14/src/modules/towerdefense
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc
r10134 r10140 130 130 131 131 Deathmatch::start(); 132 132 credits = 5000; 133 life = 20; 134 waves = 0; 133 135 time=0.0; 134 136 … … 158 160 // Generates a TowerDefenseEnemy. Uses Template "enemytowerdefense". Sets position at first waypoint of path. 159 161 160 void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate*> path , int templatenr){162 void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate*> path){ 161 163 162 164 TowerDefenseEnemy* en1 = new TowerDefenseEnemy(this->center_->getContext()); 163 164 switch(templatenr) 165 { 166 case 1 : 167 en1->addTemplate("enemytowerdefense1"); 168 en1->setScale(3); 169 break; 170 case 2 : 171 en1->addTemplate("enemytowerdefense2"); 172 en1->setScale(2); 173 break; 174 case 3 : 175 en1->addTemplate("enemytowerdefense3"); 176 en1->setScale(1); 177 break; 178 } 179 165 en1->addTemplate("enemytowerdefense"); 166 en1->setScale(3); 180 167 en1->getController(); 181 168 … … 298 285 if(time>1 && TowerDefenseEnemyvector.size() < 30) 299 286 { 300 301 addTowerDefenseEnemy(path, rand() %3 +1 ); 287 addTowerDefenseEnemy(path); 302 288 time = time-1; 303 289 } -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h
r10134 r10140 56 56 std::vector<TowerDefenseEnemy*> TowerDefenseEnemyvector; 57 57 58 void addTowerDefenseEnemy(std::vector<TDCoordinate*> path , int templatenr);58 void addTowerDefenseEnemy(std::vector<TDCoordinate*> path); 59 59 virtual void start(); //<! The function is called when the gametype starts 60 60 virtual void end(); … … 63 63 //virtual bool playerLeft(PlayerInfo* player); 64 64 65 int credits; 66 int life; 67 int waves; 65 68 //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 66 69 //virtual void playerScored(PlayerInfo* player, int score); -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc
r10134 r10140 48 48 float distance = ship.distance(*endpoint); 49 49 50 orxout() << "distance" << distance << endl; 50 51 if(distance <50){ 52 orxout() << "ENEMY KILLED!!!!" << endl; 51 53 this->destroy(); } 52 54 } -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.cc
r9667 r10140 32 32 #include "util/Convert.h" 33 33 34 35 34 namespace orxonox 36 35 { … … 50 49 { 51 50 SUPER(TowerDefenseHUDController, tick, dt); 51 52 if(showlives == true) 53 this->setCaption(multi_cast<std::string>(this->td->life)); 54 else if(showcredits == true) 55 this->setCaption(multi_cast<std::string>(this->td->credits)); 56 else if(showwaves == true) 57 this->setCaption(multi_cast<std::string>(this->td->waves)); 58 59 52 60 } 53 61 … … 55 63 { 56 64 SUPER(TowerDefenseHUDController, XMLPort, xmlelement, mode); 65 66 XMLPortParam(TowerDefenseHUDController, "showlives", setShowlives, getShowlives, xmlelement, mode); 67 XMLPortParam(TowerDefenseHUDController, "showcredits", setShowcredits, getShowcredits, xmlelement, mode); 68 XMLPortParam(TowerDefenseHUDController, "showwaves", setShowwaves, getShowwaves, xmlelement, mode); 69 57 70 } 58 71 59 72 void TowerDefenseHUDController::changedOwner() 60 { 61 SUPER(TowerDefenseHUDController, changedOwner); 62 /* 63 if (this->getOwner() != NULL && this->getOwner()->getGametype()) 64 this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype().get()); 65 else 66 this->owner_ = 0; 67 */ 68 } 73 { 74 SUPER(TowerDefenseHUDController, changedOwner); 75 76 td = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get()); 77 78 /*if (this->getOwner() != NULL && this->getOwner()->getGametype()) 79 { 80 this->owner_ = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get()); 81 } 82 else 83 { 84 this->owner_ = NULL; 85 }*/ 86 } 69 87 70 88 } -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.h
r9667 r10140 42 42 #include "tools/interfaces/Tickable.h" 43 43 #include "overlays/OverlayText.h" 44 44 #include "TowerDefense.h" 45 45 46 46 namespace orxonox … … 52 52 virtual ~TowerDefenseHUDController(); 53 53 54 54 55 virtual void tick(float dt); 55 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 56 57 virtual void changedOwner(); 58 void setShowlives(bool temp) 59 { this->showlives = temp; } 60 unsigned int getShowlives(void) const 61 { return this->showlives; } 62 63 void setShowcredits(bool temp) 64 { this->showcredits = temp; } 65 unsigned int getShowcredits(void) const 66 { return this->showcredits; } 67 68 void setShowwaves(bool temp) 69 { this->showwaves = temp; } 70 unsigned int getShowwaves(void) const 71 { return this->showwaves; } 72 73 private: 74 TowerDefense* td; 75 76 bool showcredits; 77 bool showlives; 78 bool showwaves; 57 79 }; 58 80 }
Note: See TracChangeset
for help on using the changeset viewer.