Changeset 10591
- Timestamp:
- Sep 17, 2015, 3:32:50 PM (9 years ago)
- Location:
- code/branches/towerdefenseFabien
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFabien/data/levels/towerDefense.oxw
r10586 r10591 235 235 explosionchunks = 6 236 236 237 health = 1 238 maxhealth = 2239 initialhealth = 1 240 241 shieldhealth = 30242 initialshieldhealth = 30243 maxshieldhealth = 50237 health = 15 238 maxhealth = 15 239 initialhealth = 15 240 241 shieldhealth = 15 242 initialshieldhealth = 15 243 maxshieldhealth = 15 244 244 shieldabsorption = 0.8 245 245 reloadrate = 1 246 246 reloadwaittime = 1 247 247 248 primaryThrust = 100 248 primaryThrust = 1000 249 249 auxilaryThrust = 30 250 rotationThrust = 50250 rotationThrust = 80 251 251 252 252 lift = 1; … … 262 262 263 263 collisionType = "dynamic" 264 mass = 10 0264 mass = 10 265 265 linearDamping = 0.7 266 266 angularDamping = 0.9999999 … … 287 287 </collisionShapes> 288 288 <controller> 289 <WaypointController accuracy=60> 290 </WaypointController> 289 <WaypointController accuracy = 50/> 291 290 </controller> 292 291 </TowerDefenseEnemy> … … 301 300 explosionchunks = 6 302 301 303 health = 100304 maxhealth = 200305 initialhealth = 100306 307 shieldhealth = 30308 initialshieldhealth = 30309 maxshieldhealth = 50302 health = 30 303 maxhealth = 30 304 initialhealth = 30 305 306 shieldhealth = 0 307 initialshieldhealth = 0 308 maxshieldhealth = 0 310 309 shieldabsorption = 0.8 311 310 reloadrate = 1 … … 314 313 primaryThrust = 100 315 314 auxilaryThrust = 30 316 rotationThrust = 50315 rotationThrust = 80 317 316 318 317 lift = 1; … … 338 337 <Engine position=" 0, 0, 0" 339 338 boostfactor = 2 340 speedfront = 1 50339 speedfront = 100 341 340 speedback = 50 342 341 speedleftright = 50 343 speedupdown = 50 342 speedupdown = 50 344 343 accelerationfront = 500 345 344 accelerationbrake = 500 … … 359 358 <BoxCollisionShape position="0,0.1,-11" halfExtents="2.2, 1.8, 6" /> 360 359 <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" /> 361 </collisionShapes> 362 <controller> 363 <WaypointController accuracy=60> 364 </WaypointController> 365 </controller> 360 </collisionShapes> 361 <controller> 362 <WaypointController accuracy = 50/> 363 </controller> 366 364 </TowerDefenseEnemy> 367 365 </Template> … … 375 373 explosionchunks = 6 376 374 377 health = 1 00378 maxhealth = 200379 initialhealth = 1 00375 health = 15 376 maxhealth = 15 377 initialhealth = 15 380 378 381 shieldhealth = 30382 initialshieldhealth = 30383 maxshieldhealth = 5 0379 shieldhealth = 5 380 initialshieldhealth = 5 381 maxshieldhealth = 5 384 382 shieldabsorption = 0.8 385 383 reloadrate = 1 … … 388 386 primaryThrust = 100 389 387 auxilaryThrust = 30 390 rotationThrust = 50388 rotationThrust = 80 391 389 392 390 lift = 1; … … 412 410 <Engine position=" 0, 0, 0" 413 411 boostfactor = 2 414 speedfront = 150415 speedback = 50416 speedleftright = 50417 speedupdown = 50412 speedfront = 300 413 speedback = 300 414 speedleftright = 300 415 speedupdown = 300 418 416 accelerationfront = 500 419 417 accelerationbrake = 500 420 accelerationback = 125421 accelerationleftright = 125422 accelerationupdown = 125418 accelerationback = 500 419 accelerationleftright = 500 420 accelerationupdown = 500 423 421 /> 424 422 </engines> … … 435 433 </collisionShapes> 436 434 <controller> 437 <WaypointController accuracy=60> 438 </WaypointController> 439 </controller> 435 <WaypointController accuracy = 50/> 436 </controller> 440 437 </TowerDefenseEnemy> 441 438 </Template> … … 486 483 F1F1F1I2F1F1F1F1F1F1F1F1F1F1F1F1 487 484 F1F1F1I2F1F1F1F1F1F1F1F1F1F1F1F1 485 F1F1F1I2F1F1F1F1F1F1F1Y1Y1Y1F1F1 488 486 F1F1F1I2F1F1F1F1F1F1F1F1F1F1F1F1 489 F1F1F1I2F1F1F1F1F1F1F1F1F1F1F1F1 490 F1F1F1I2F1F1F1F1F1F1F1F1F1F1F1F1 487 F1F1F1I2F1F1F1F1F1F1F1Y1Y1Y1F1F1 491 488 F1F1F1R2I3I3I3I3L3F1F1F1F1F1F1F1 492 489 F1F1F1F1F1F1F1F1I2F1F1F1F1F1F1F1 -
code/branches/towerdefenseFabien/data/overlays/towerdefenseHUD.oxo
r10258 r10591 1 1 <Template name="TowerDefenseHUD"> 2 <OverlayGroup name="TowerDefenseHUD" scale = "1, 1"> 3 4 <TowerDefenseHUDController 5 position = "0.9, 0.10" 6 pickpoint = "0.0, 0.0" 7 font = "ShareTechMono" 8 textsize = 0.05 9 colour = "1.0, 1.0, 1.0, 1.0" 10 align = "left" 11 showlives = false 12 showcredits = true 13 showwaves = false 14 /> 2 15 16 <TowerDefenseHUDController 17 position = "0.9, 0.25" 18 pickpoint = "0.0, 0.0" 19 font = "ShareTechMono" 20 textsize = 0.05 21 colour = "1.0, 1.0, 1.0, 1.0" 22 align = "left" 23 showlives = true 24 showcredits = false 25 showwaves = false 26 /> 27 28 <TowerDefenseHUDController 29 position = "0.9, 0.40" 30 pickpoint = "0.0, 0.0" 31 font = "ShareTechMono" 32 textsize = 0.05 33 colour = "1.0, 1.0, 1.0, 1.0" 34 align = "left" 35 showlives = false 36 showcredits = false 37 showwaves = true 38 /> 3 39 4 <OverlayGroup name="TowerDefenseHUD" scale = "1, 1">5 6 7 40 <OverlayText 8 position = "0.8 3, 0.05"41 position = "0.8, 0.1" 9 42 pickpoint = "0.0, 0.0" 10 43 font = "ShareTechMono" … … 16 49 /> 17 50 18 19 <TowerDefenseHUDController 20 position = "0.88, 0.10" 21 pickpoint = "0.0, 0.0" 22 font = "ShareTechMono" 23 textsize = 0.05 24 colour = "1.0, 1.0, 1.0, 1.0" 25 align = "left" 26 showlives = false 27 showcredits = true 28 showwaves = false 29 /> 30 31 <OverlayText 32 position = "0.83, 0.22" 51 <OverlayText 52 position = "0.8, 0.25" 33 53 pickpoint = "0.0, 0.0" 34 54 font = "ShareTechMono" … … 40 60 /> 41 61 42 <TowerDefenseHUDController 43 position = "0.88, 0.27" 44 pickpoint = "0.0, 0.0" 45 font = "ShareTechMono" 46 textsize = 0.05 47 colour = "1.0, 1.0, 1.0, 1.0" 48 align = "left" 49 showlives = true 50 showcredits = false 51 showwaves = false 52 /> 53 54 <OverlayText 55 position = "0.83, 0.39" 62 <OverlayText 63 position = "0.8, 0.40" 56 64 pickpoint = "0.0, 0.0" 57 65 font = "ShareTechMono" … … 63 71 /> 64 72 65 <TowerDefenseHUDController66 position = "0.88, 0.44"67 pickpoint = "0.0, 0.0"68 font = "ShareTechMono"69 textsize = 0.0570 colour = "1.0, 1.0, 1.0, 1.0"71 align = "left"72 showlives = false73 showcredits = false74 showwaves = true75 76 />77 78 79 73 </OverlayGroup> 80 74 </Template> -
code/branches/towerdefenseFabien/src/modules/towerdefense/TowerDefense.cc
r10589 r10591 87 87 namespace orxonox 88 88 { 89 static const std::string __CC_addTower_name = "addTower";90 static const std::string __CC_upgradeTower_name = "upgradeTower";91 92 SetConsoleCommand("TowerDefense", __CC_addTower_name, &TowerDefense::addTower ).addShortcut().defaultValues(1);93 SetConsoleCommand("TowerDefense", __CC_upgradeTower_name, &TowerDefense::upgradeTower).addShortcut().defaultValues(0);94 95 89 RegisterUnloadableClass(TowerDefense); 96 90 … … 102 96 this->player_ = NULL; 103 97 this->setHUDTemplate("TowerDefenseHUD"); 104 this->nextwaveTimer_.setTimer(10, false, createExecutor(createFunctor(&TowerDefense::nextwave, this))); 105 this->nextwaveTimer_.stopTimer(); 106 this->waves_ = 0; 107 this->time = 0; 98 this->waveNumber_ = 0; 99 this->timeSinceLastSpawn_ = 0.0; 100 this->timeUntilNextWave_ = 0.0; 108 101 this->credit_ = 0; 109 102 this->lifes_ = 0; 103 this->waveSize_ = 0; 104 offset_ = Vector3(0,0,10); 110 105 111 106 //this->stats_ = new TowerDefensePlayerStats(); 112 113 ModifyConsoleCommand(__CC_addTower_name).setObject(this);114 ModifyConsoleCommand(__CC_upgradeTower_name).setObject(this);115 107 } 116 108 117 109 TowerDefense::~TowerDefense() 118 { /* Part of a temporary hack to allow the player to add towers */110 { 119 111 if (this->isInitialized()) 120 112 { 121 ModifyConsoleCommand(__CC_addTower_name).setObject(NULL); 122 ModifyConsoleCommand(__CC_upgradeTower_name).setObject(NULL); 113 123 114 } 124 115 } … … 149 140 150 141 createFields(); 151 152 142 TeamDeathmatch::start(); 153 154 // Waypoints: [1,3] [10,3] [10,11] [13,11] -> add the points to a matrix so the player cant place towers on the path155 156 143 157 144 //set initial credits, lifes and WaveNumber 158 145 this->setCredit(1000); 159 this->setLifes(100); 146 this->setLifes(100); 147 this->timeSinceLastSpawn_ = 0.0; 148 this->timeUntilNextWave_ = 5.0; 149 this->waveSize_ = 0; 160 150 this->setWaveNumber(0); 161 time = 0.0;162 151 } 163 152 … … 165 154 void TowerDefense::addTowerDefenseEnemy(int templatenr) 166 155 { 167 orxout() << "addTowerDefenseEnemy" << endl;168 169 156 TowerDefenseEnemy* en1 = new TowerDefenseEnemy(this->center_->getContext()); 170 157 … … 200 187 if (controller != NULL && waypoints_.size() > 1) 201 188 { 202 en1->setPosition(waypoints_.at(0)->getPosition() );189 en1->setPosition(waypoints_.at(0)->getPosition() + offset_); 203 190 en1->setOrientation(Vector3(0,0,10), Degree(0)); 204 191 en1->setDirection(Vector3(0,1,0)); 205 en1->lookAt(waypoints_.at(1)->getPosition() );192 en1->lookAt(waypoints_.at(1)->getPosition() + offset_); 206 193 207 194 for (unsigned int i = 0; i < waypoints_.size(); ++ i) 208 195 { 209 196 orxonox::WeakPtr<MovableEntity> waypoint = new MovableEntity(this->center_->getContext()); 210 waypoint->setPosition(waypoints_.at(i)->getPosition() );197 waypoint->setPosition(waypoints_.at(i)->getPosition() + offset_); 211 198 controller->addWaypoint(waypoint); 212 199 } … … 229 216 assert(player); 230 217 player_ = player; 231 232 orxout() << "spawnPlayer" << endl;233 218 234 219 if (selecter->getPlayer() == NULL) … … 287 272 void TowerDefense::tick(float dt) 288 273 { 289 //orxout() << "tick1" << endl;290 274 SUPER(TowerDefense, tick, dt); 291 //orxout() << "tick2" << endl;292 275 293 276 if (hasStarted() == false || player_ == NULL) … … 295 278 return; 296 279 } 297 time += dt; 280 timeUntilNextWave_ -= dt; 281 timeSinceLastSpawn_ += dt; 298 282 299 283 //build/upgrade tower at selecter position … … 311 295 } 312 296 } 313 314 if (time >= 1.3 * enemies_.size() && enemies_.size() < 10) 315 { 316 //adds different types of enemys depending on the WaveNumber 317 addTowerDefenseEnemy(this->getWaveNumber() % 3 +1 ); 318 } 319 320 //if ships are at the end they get destroyed 321 297 322 298 for (std::list<WeakPtr<TowerDefenseEnemy> >::iterator it = enemies_.begin(); it != enemies_.end(); ) 323 299 { … … 326 302 // the enemy was destroyed by a tower - remove it from the list 327 303 enemies_.erase(it++); 304 addCredit(1); 328 305 } 329 306 else 330 307 { 331 // destroys enemys at the end of the path and reduces the life by 1. No credits gifted308 //if ships are at the end they get destroyed 332 309 Vector3 ship = (*it)->getRVWorldPosition(); 333 310 float distance = ship.distance(endpoint_); 334 if(distance < 50)311 if(distance < 40) 335 312 { 336 orxout() << "enemy deleted" << endl;337 313 (*it)->destroy(); 338 314 enemies_.erase(it++); … … 348 324 } 349 325 } 350 } 351 352 if (enemies_.size() == 0 && !this->nextwaveTimer_.isActive()) 353 { 354 this->nextwaveTimer_.startTimer(); 355 } 326 } 327 328 // Add new enemy? 329 if (timeSinceLastSpawn_ >= 1.0 && waveSize_ > 0) 330 { 331 // Add new enemy 332 timeSinceLastSpawn_ -= 1.0; 333 -- waveSize_; 334 addTowerDefenseEnemy(this->getWaveNumber() % 3 + 1); 335 } 336 else if (timeUntilNextWave_ <= 0.0 && waveSize_ <= 0) 337 { 338 //New wave 339 ++ waveNumber_; 340 timeSinceLastSpawn_ = 0.0; 341 342 timeUntilNextWave_ = waveNumber_+10; 343 waveSize_ = waveNumber_+5; 344 } 345 356 346 } 357 347 … … 361 351 TDCoordinate coord(0,0); 362 352 TDCoordinate startCoord(0,0); 363 364 353 std::string fields = center_->getFields(); 365 354 int pos = 0; … … 372 361 fields_[i][j]->setCenterpoint(center_); 373 362 center_->attach(fields_[i][j]); 374 fields_[i][j]->setPosition(coord.get3dcoordinate()); 375 fields_[i][j]->create(fields.at(pos), fields.at(pos+1)); 363 fields_[i][j]->setPosition(coord.get3dcoordinate()); 364 fields_[i][j]->create(fields.at(pos), fields.at(pos+1)); 376 365 pos += 2; 377 366 if (fields_[i][j]->getType() == START) … … 382 371 } 383 372 } 384 385 373 //Place waypoints along the street for the waypoint controllers of the enemies 386 374 TDCoordinate* thisCoord = &startCoord; … … 429 417 return NULL; 430 418 } 431 432 /*433 void TowerDefense::playerEntered(PlayerInfo* player)434 {435 TeamDeathmatch::playerEntered(player);436 437 const std::string& message = player->getName() + " entered the game";438 ChatManager::message(message);439 }440 441 bool TowerDefense::playerLeft(PlayerInfo* player)442 {443 bool valid_player = TeamDeathmatch::playerLeft(player);444 445 if (valid_player)446 {447 const std::string& message = player->getName() + " left the game";448 ChatManager::message(message);449 }450 451 return valid_player;452 }453 454 455 void TowerDefense::pawnKilled(Pawn* victim, Pawn* killer)456 {457 if (victim && victim->getPlayer())458 {459 std::string message;460 if (killer)461 {462 if (killer->getPlayer())463 message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName();464 else465 message = victim->getPlayer()->getName() + " was killed";466 }467 else468 message = victim->getPlayer()->getName() + " died";469 470 ChatManager::message(message);471 }472 473 TeamDeathmatch::pawnKilled(victim, killer);474 }475 476 void TowerDefense::playerScored(PlayerInfo* player, int score)477 {478 Gametype::playerScored(player, score);479 }*/480 419 } -
code/branches/towerdefenseFabien/src/modules/towerdefense/TowerDefense.h
r10587 r10591 61 61 void payCredit(int pay){ this->credit_ -= pay; } 62 62 int getLifes(){ return this->lifes_; } 63 int getWaveNumber(){ return this->waves_; } 63 int getWaveNumber(){ return this->waveNumber_; } 64 void setWaveNumber(int wavenumber){ waveNumber_=wavenumber; } 64 65 void setCredit(int credit){ credit_ = credit; } 65 void setLifes(int lifes){ lifes_ = lifes; } 66 void setWaveNumber(int wavenumber){ waves_=wavenumber; } 67 void buyTower(int cost){ credit_ -= cost;} 66 void setLifes(int lifes){ lifes_ = lifes; } 67 void buyTower(int cost){ cost -= cost;} 68 68 void addCredit(int credit) { credit_+=credit; } 69 void nextwave(){ enemies_.clear(); waves_++; time=0;}70 69 int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; } 71 70 TowerDefenseField* getField(TDCoordinate* coord){ return fields_[coord->GetX()][coord->GetY()]; } 72 /* Called by TowerDefenseCenterpoint upon game start73 The centerpoint is used to create towers74 */75 71 void setCenterpoint(TowerDefenseCenterpoint* centerpoint); 76 /* Adds a tower at x, y in the playfield */77 72 void addTower(int x, int y); 78 73 void upgradeTower(int x, int y); 79 74 virtual TDCoordinate* getNextStreetCoord(TDCoordinate*); 80 81 //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 82 //virtual void playerScored(PlayerInfo* player, int score); 83 75 84 76 TowerDefenseSelecter* selecter; 85 77 86 //TODO: void spawnNewWave() 87 //TODO: create a timer which regularly calls the spawnNewWave function (time driven) 88 // or spawn a new wave when the old wave has been killed (event driven) 78 private: 79 void createFields(); 89 80 90 private:91 81 orxonox::WeakPtr<TowerDefenseCenterpoint> center_; 92 82 PlayerInfo* player_; 93 float time; 83 float timeSinceLastSpawn_; 84 float timeUntilNextWave_; 85 int waveSize_; 94 86 int credit_; 95 int wave s_;87 int waveNumber_; 96 88 int lifes_; 97 Timer nextwaveTimer_;98 89 std::list<orxonox::WeakPtr<TowerDefenseEnemy> > enemies_; 99 90 TowerDefenseField* fields_[16][16]; 100 91 std::vector<orxonox::WeakPtr<TowerDefenseField> > waypoints_; 101 92 Vector3 endpoint_; 102 103 void createFields(); 93 Vector3 offset_; 104 94 }; 105 95 } -
code/branches/towerdefenseFabien/src/modules/towerdefense/TowerDefenseEnemy.cc
r10586 r10591 35 35 TowerDefenseEnemy::~TowerDefenseEnemy() 36 36 { 37 orxout() << "TowerDefenseEnemy::~TowerDefenseEnemy" << endl; 37 38 38 } 39 39 … … 57 57 void TowerDefenseEnemy::damage(float damage, float healthdamage, float shielddamage, Pawn* originator) 58 58 { 59 orxout() << "TowerDefenseEnemy::damage" << endl;60 59 Pawn::damage(damage, healthdamage, shielddamage, originator); 60 61 61 if (getGame() && once_ == false && getHealth() <= 0) 62 62 { -
code/branches/towerdefenseFabien/src/modules/towerdefense/TowerDefenseField.cc
r10586 r10591 53 53 center_ = NULL; 54 54 upgrade_ = 0; 55 setPosition(0,0,0); 56 model_ = new Model(getContext()); 57 model_->setScale(25); 58 model_->pitch(Degree(90)); 59 attach(model_); 60 setAngle(0); 55 setPosition(0,0,0); 56 modelGround_ = new Model(getContext()); 57 modelGround_->setScale(25); 58 modelGround_->pitch(Degree(90)); 59 attach(modelGround_); 60 modelObject_ = new Model(getContext()); 61 modelObject_->setScale(25); 62 modelObject_->pitch(Degree(90)); 63 attach(modelObject_); 64 setAngle(0); 61 65 } 62 66 … … 125 129 void TowerDefenseField::setAngle(int newAngle) 126 130 { 127 if (model_ == NULL) 128 { 129 return; 130 } 131 132 switch (newAngle) 133 { 131 if (modelGround_ != NULL) 132 { 133 switch (newAngle) 134 { 134 135 case 0: 135 model _->yaw(Degree(0));136 modelGround_->yaw(Degree(0)); 136 137 angle_ = 0; 137 138 break; 138 139 case 1: 139 model _->yaw(Degree(90));140 modelGround_->yaw(Degree(90)); 140 141 angle_ = 1; 141 142 break; 142 143 case 2: 143 model _->yaw(Degree(180));144 modelGround_->yaw(Degree(180)); 144 145 angle_ = 2; 145 146 break; 146 147 case 3: 147 model _->yaw(Degree(270));148 modelGround_->yaw(Degree(270)); 148 149 angle_ = 3; 149 150 break; 150 } 151 } 152 } 153 154 if (modelObject_ != NULL) 155 { 156 switch (newAngle) 157 { 158 case 0: 159 modelObject_->yaw(Degree(0)); 160 angle_ = 0; 161 break; 162 case 1: 163 modelObject_->yaw(Degree(90)); 164 angle_ = 1; 165 break; 166 case 2: 167 modelObject_->yaw(Degree(180)); 168 angle_ = 2; 169 break; 170 case 3: 171 modelObject_->yaw(Degree(270)); 172 angle_ = 3; 173 break; 174 } 175 } 176 151 177 } 152 178 … … 158 184 void TowerDefenseField::createFree(int orientation) 159 185 { 160 model _->setMeshSource("TD_F1.mesh");186 modelGround_->setMeshSource("TD_F1.mesh"); 161 187 tower_ = NULL; 162 188 type_ = FREE; … … 167 193 void TowerDefenseField::createStart(int orientation) 168 194 { 169 model _->setMeshSource("TD_S5.mesh");195 modelGround_->setMeshSource("TD_S5.mesh"); 170 196 tower_ = NULL; 171 197 type_ = START; … … 177 203 void TowerDefenseField::createEnd(int orientation) 178 204 { 179 model _->setMeshSource("TD_S4.mesh");205 modelGround_->setMeshSource("TD_S4.mesh"); 180 206 tower_ = NULL; 181 207 type_ = END; … … 186 212 void TowerDefenseField::createStraight(int orientation) 187 213 { 188 model _->setMeshSource("TD_S1.mesh");214 modelGround_->setMeshSource("TD_S1.mesh"); 189 215 tower_ = NULL; 190 216 type_ = STREET; … … 195 221 void TowerDefenseField::createRCurve(int orientation) 196 222 { 197 model _->setMeshSource("TD_S2.mesh");223 modelGround_->setMeshSource("TD_S2.mesh"); 198 224 tower_ = NULL; 199 225 type_ = STREET; … … 204 230 void TowerDefenseField::createLCurve(int orientation) 205 231 { 206 model _->setMeshSource("TD_S3.mesh");232 modelGround_->setMeshSource("TD_S3.mesh"); 207 233 tower_ = NULL; 208 234 type_ = STREET; … … 210 236 setAngle(orientation); 211 237 } 238 239 void TowerDefenseField::createObstacle(int orientation) 240 { 241 modelGround_->setMeshSource("TD_F1.mesh"); 242 modelObject_->setMeshSource("TD_O1.mesh"); 243 tower_ = NULL; 244 type_ = OBSTACLE; 245 setUpgrade(0); 246 setAngle(orientation); 247 } 212 248 213 249 void TowerDefenseField::createTower(int upgrade) … … 215 251 if (tower_ == NULL) 216 252 { 253 modelGround_->setMeshSource("TD_F1.mesh"); 217 254 tower_ = new TowerDefenseTower(center_->getContext()); 218 255 attach(tower_); 219 256 type_ = TOWER; 220 257 setUpgrade(upgrade); 221 if (upgrade_ > 0 && model _ != NULL)258 if (upgrade_ > 0 && modelObject_ != NULL) 222 259 { 223 260 switch (upgrade_) 224 261 { 225 262 case 1: 226 model _->setMeshSource("TD_T1.mesh");263 modelObject_->setMeshSource("TD_T1.mesh"); 227 264 tower_->addTemplate(center_->getTower1Template()); 228 265 break; 229 266 case 2: 230 model _->setMeshSource("TD_T2.mesh");267 modelObject_->setMeshSource("TD_T2.mesh"); 231 268 tower_->addTemplate(center_->getTower2Template()); 232 269 break; 233 270 case 3: 234 model _->setMeshSource("TD_T3.mesh");271 modelObject_->setMeshSource("TD_T3.mesh"); 235 272 tower_->addTemplate(center_->getTower3Template()); 236 273 break; 237 274 case 4: 238 model _->setMeshSource("TD_T4.mesh");275 modelObject_->setMeshSource("TD_T4.mesh"); 239 276 tower_->addTemplate(center_->getTower4Template()); 240 277 break; 241 278 case 5: 242 model _->setMeshSource("TD_T5.mesh");279 modelObject_->setMeshSource("TD_T5.mesh"); 243 280 tower_->addTemplate(center_->getTower5Template()); 244 281 break; … … 279 316 case 'O': 280 317 createEnd(paramInt); 281 break; 318 break; 319 case 'Y': 320 createObstacle(paramInt); 321 break; 282 322 case 'T': 283 323 createTower(paramInt); -
code/branches/towerdefenseFabien/src/modules/towerdefense/TowerDefenseField.h
r10586 r10591 52 52 START, 53 53 END, 54 OBSTACLE, 54 55 TOWER 55 56 }; … … 77 78 virtual void createLCurve(int orientation); 78 79 virtual void createRCurve(int orientation); 80 virtual void createObstacle(int orientation); 79 81 virtual void createTower(int upgrade); 80 virtual int getAngle(); 82 virtual int getAngle(); 81 83 private: 82 84 virtual void setAngle(int newAngle); … … 84 86 int angle_; 85 87 TowerDefenseFieldType type_; 86 Model* model_; 88 Model* modelGround_; 89 Model* modelObject_; 87 90 TowerDefenseTower* tower_; 88 91 TowerDefenseCenterpoint* center_; -
code/branches/towerdefenseFabien/src/modules/towerdefense/TowerDefenseHUDController.cc
r10258 r10591 50 50 { 51 51 SUPER(TowerDefenseHUDController, tick, dt); 52 52 53 const std::string& lifes = multi_cast<std::string>(this->td->getLifes()); 53 54 const std::string& credits = multi_cast<std::string>(this->td->getCredit()); … … 55 56 56 57 if(showlives == true) 57 this->setCaption(multi_cast<std::string>(lifes)); 58 { 59 this->setCaption(multi_cast<std::string>(lifes)); 60 } 58 61 else if(showcredits == true) 59 this->setCaption(multi_cast<std::string>(credits)); 62 { 63 this->setCaption(multi_cast<std::string>(credits)); 64 } 60 65 else if(showwaves == true) 61 this->setCaption(multi_cast<std::string>(wave));62 63 66 { 67 this->setCaption(multi_cast<std::string>(wave)); 68 } 64 69 } 65 70
Note: See TracChangeset
for help on using the changeset viewer.