Changeset 12125
- Timestamp:
- Nov 28, 2018, 11:50:56 AM (6 years ago)
- Location:
- code/branches/TowerDefense_HS18
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/TowerDefense_HS18/data/levels/towerDefense.oxw
r11052 r12125 23 23 <TowerDefenseSelecter> 24 24 <camerapositions> 25 <CameraPosition position="0,0,1 300" lookat="0,0,0" absolute=true drag=true mouselook=true/>25 <CameraPosition position="0,0,1400" lookat="0,0,0" absolute=true drag=true mouselook=true/> 26 26 </camerapositions> 27 27 </TowerDefenseSelecter> … … 301 301 <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" /> 302 302 </collisionShapes> 303 <controller> 304 <WaypointController accuracy = 50/> 305 </controller> 303 <!-- Hier wurde der Controller entfernt--> 306 304 </TowerDefenseEnemy> 307 305 </Template> … … 374 372 <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" /> 375 373 </collisionShapes> 376 <controller>377 <WaypointController accuracy = 50/>378 </controller>379 374 </TowerDefenseEnemy> 380 375 </Template> … … 447 442 <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" /> 448 443 </collisionShapes> 449 <controller>450 <WaypointController accuracy = 50/>451 </controller>452 444 </TowerDefenseEnemy> 453 445 </Template> … … 501 493 F1F1F1I2F1F1F1F1F1F1F1F1F1F1F1F1 502 494 F1F1F1I2F1F1F1F1F1F1F1Y1Y1Y1F1F1 503 F1F1F1R2I3I3I3I3 L3F1F1F1F1F1F1F1504 F1F1F1F1F1F1F1F1 I2F1F1F1F1F1F1F1505 F1F1F1F1F1F1F1F1 I2F1F1F1F1F1F1F1506 X1I1I1I1R0F1F1F1 I2F1F1F1F1F1F1F1507 F1F1F1F1I0F1F1F1 I2F1F1F1F1F1F1F1508 F1F1F1F1I0F1F1F1 I2F1F1F1F1F1F1F1509 F1F1F1F1L1I1I1I1 L2F1F1F1F1F1F1F1495 F1F1F1R2I3I3I3I3I3I3I3L3F1F1F1F1 496 F1F1F1F1F1F1F1F1F1F1F1I2F1F1F1F1 497 F1F1F1F1F1F1F1F1F1F1F1I2F1F1F1F1 498 X1I1I1I1R0F1F1F1F1F1F1I2F1F1F1F1 499 F1F1F1F1I0F1F1F1F1F1F1I2F1F1F1F1 500 F1F1F1F1I0F1F1F1F1F1F1I2F1F1F1F1 501 F1F1F1F1L1I1I1I1I1I1I1L2F1F1F1F1 510 502 F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1 511 503 F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1 -
code/branches/TowerDefense_HS18/src/modules/towerdefense/CMakeLists.txt
r10629 r12125 10 10 TowerDefenseField.cc 11 11 TDCoordinate.cc 12 TowerDefenseController.cc 12 13 ) 13 14 -
code/branches/TowerDefense_HS18/src/modules/towerdefense/TowerDefense.cc
r11716 r12125 76 76 #include "TowerDefenseCenterpoint.h" 77 77 #include "worldentities/SpawnPoint.h" 78 #include " controllers/WaypointController.h"78 #include "TowerDefenseController.h" //muss ich noch in den richtigen Ordner verschieben 79 79 #include "graphics/Model.h" 80 80 #include "infos/PlayerInfo.h" … … 175 175 en1->setTeam(2); 176 176 177 WaypointController* controller = (WaypointController*)(en1->getXMLController()); 178 179 if (controller != nullptr && waypoints_.size() > 1) 177 //Jedem Enemy wird ein eigener Controller uebergeben 178 TowerDefenseController* controller = new TowerDefenseController(this->center_->getContext()); 179 controller->setControllableEntity(en1); 180 en1->setController(controller); 181 182 if (waypoints_.size() > 1) 180 183 { 181 184 en1->setPosition(waypoints_.at(0)->getPosition() + offset_); … … 192 195 } 193 196 194 enemies_.push_back(en1); 197 auto pair = std::make_pair(orxonox::WeakPtr<TowerDefenseEnemy>(en1), controller); 198 enemies_.push_back(pair); 195 199 } 196 200 … … 291 295 } 292 296 } 297 293 298 294 for (std::list<WeakPtr<TowerDefenseEnemy>>::iterator it = enemies_.begin(); it != enemies_.end(); ) 295 { 296 if (*it == nullptr) 297 { 298 // the enemy was destroyed by a tower - remove it from the list 299 enemies_.erase(it++); 299 for (EnemyList::iterator it = enemies_.begin(); it != enemies_.end(); ) 300 { 301 WeakPtr<TowerDefenseEnemy> enemy = it->first; 302 TowerDefenseController* ctrl = it->second; 303 304 if (enemy == nullptr) 305 { 306 307 // the enemy was destroyed by a tower - remove it from the list AND destroy the corresponding controler 308 ctrl->destroy(); 309 it = enemies_.erase(it); 300 310 addCredit(1); 301 311 } … … 303 313 { 304 314 //if ships are at the end they get destroyed 305 Vector3 ship = (*it)->getRVWorldPosition();315 Vector3 ship = enemy->getRVWorldPosition(); 306 316 float distance = ship.distance(endpoint_); 307 317 if(distance < 40) 308 318 { 309 (*it)->destroy(); 310 enemies_.erase(it++); 319 enemy->getController()->destroy(); 320 enemy->destroy(); 321 322 it = enemies_.erase(it); 311 323 this->reduceLifes(1); 312 324 if (this->getLifes() == 0) … … 412 424 } 413 425 426 //Falls kein anliegender Weg gefunden wurde. 414 427 delete nextCoord; 415 428 return nullptr; -
code/branches/TowerDefense_HS18/src/modules/towerdefense/TowerDefense.h
r11099 r12125 32 32 #include "TDCoordinate.h" 33 33 #include "TowerDefenseSelecter.h" 34 #include "TowerDefenseController.h" 34 35 #include "towerdefense/TowerDefensePrereqs.h" 35 36 #include "gametypes/TeamDeathmatch.h" … … 40 41 namespace orxonox 41 42 { 43 using EnemyList = std::list<std::pair<orxonox::WeakPtr<TowerDefenseEnemy>, TowerDefenseController*>>; 44 42 45 /** 43 46 @brief … … 86 89 int waveNumber_; 87 90 int lifes_; 88 std::list<orxonox::WeakPtr<TowerDefenseEnemy>>enemies_;91 EnemyList enemies_; 89 92 TowerDefenseField* fields_[16][16]; 90 93 std::vector<orxonox::WeakPtr<TowerDefenseField>> waypoints_; -
code/branches/TowerDefense_HS18/src/modules/towerdefense/TowerDefenseEnemy.cc
r11099 r12125 29 29 TowerDefenseEnemy::~TowerDefenseEnemy() 30 30 { 31 32 31 } 33 32
Note: See TracChangeset
for help on using the changeset viewer.