Changeset 9621
- Timestamp:
- May 7, 2013, 3:58:33 PM (12 years ago)
- Location:
- code/branches/formationupdate
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/formationupdate/data/levels/maxim.oxw
r9615 r9621 20 20 <Level 21 21 gametype = "Mission" 22 > 22 > 23 23 <templates> 24 24 <Template link=lodtemplate_default /> … … 49 49 <!-- TRIGGERS --> 50 50 <DistanceTrigger name="FormationInit" position="800,700,600" target="Pawn" distance=60 stayActive="true" delay=0.1 /> 51 <DistanceTrigger name="LetsGo" position="200,-200,1000" target="Pawn" distance=180 stayActive="true" delay=0.1 /> 51 52 <BlinkingBillboard colour="1,1,0.05"position="200,-200,1000" frequency=0.6 amplitude=3 material="Flares/lensflare" > 52 53 </BlinkingBillboard> 53 54 <DistanceTrigger name="Fight" position="-600,3000,-2000" target="Pawn" distance=180 stayActive="true" delay=0.1 /> 55 <BlinkingBillboard colour="0,0,1"position="-600,3000,-2000" frequency=0.6 amplitude=3 material="Flares/lensflare" > 56 </BlinkingBillboard> 54 57 55 58 … … 63 66 </Script> <!-- !!! activates formation behaviour !!! --> 64 67 68 <Script code="artificialcontroller setbotlevel 3" onLoad="false"> 69 <events> 70 <trigger> 71 <EventListener event=FormationInit /> 72 </trigger> 73 </events> 74 </Script> 65 75 66 <!-- ADDING FORMATION: 5 Swallows --> 67 <?lua for i=0,1,1 do 68 ?> 69 <SpaceShip position="<?lua print(800+i*200) ?>,700,600" lookat="-1300,-600,900" visible="true"> 70 <templates> 71 <Template link=spaceshipswallow /> 72 </templates> 73 <controller> 74 <AIController team=0/> 75 </controller> 76 </SpaceShip> 77 <?lua end ?> 78 79 80 <!-- ADDING ENEMY FORMATION: 5 Swallows --> 76 <SimpleNotification message="Let's go!"> 77 <events> 78 <trigger> 79 <EventListener event="LetsGo" /> 80 </trigger> 81 </events> 82 </SimpleNotification> 81 83 82 <?lua for i=0,1,1 do 83 ?> 84 <SpaceShip position="<?lua print(5000+i*200) ?>,-200,1000" lookat="-1300,-600,900" visible="true"> 85 <templates> 86 <Template link=spaceshipswallow /> 87 </templates> 88 <controller> 89 <AIController team=1/> 90 </controller> 91 </SpaceShip> 92 <?lua end ?> 84 85 86 87 <!-- ADDING FORMATION: 2 Swallows --> 88 <?lua for i=0,1,1 do 89 ?> 90 <SpaceShip position="<?lua print(400+i*200) ?>,-200,1000" lookat="-1300,-600,900" visible="true"> 91 <!--events> 92 <visibility> 93 <EventListener event="ondock" /> 94 </visibility> 95 </events--> 96 <templates> 97 <Template link=spaceshipswallow /> <!--spaceshipTransporter spaceshippirate--> 98 </templates> 99 <controller> 100 <AIController team=0> 101 <events> 102 <activity> 103 <EventListener event="LetsGo" /> 104 </activity> 105 </events> 106 </AIController> 107 </controller> 108 </SpaceShip> 109 <?lua end ?> 110 111 <?lua for i=0,2,1 do 112 ?> 113 114 115 <!-- ENEMY SWALLOWS --> 116 <SpaceShip position="<?lua print(-400+i*200) ?>,3000,-2000" lookat="-1300,-600,900" visible="true"> 117 <templates> 118 <Template link=spaceshipswallow /> 119 </templates> 120 <controller> 121 <AIController team=1> 122 <events> 123 <activity> 124 <EventListener event="Fight" /> 125 </activity> 126 </events> 127 </AIController> 128 </controller> 129 </SpaceShip> 130 <?lua end ?> 131 93 132 </Scene> 94 133 </Level> 95 -
code/branches/formationupdate/src/orxonox/controllers/FormationController.cc
r9620 r9621 535 535 536 536 537 // Sets newMaster as the new master within the formation. Called by the master. 537 538 void FormationController::setNewMasterWithinFormation(FormationController* newMaster) 538 539 { … … 565 566 566 567 /** 567 @brief Frees all slaves f orm a master. Initiated by a master.568 @brief Frees all slaves from a master. Initiated by a master. 568 569 */ 569 570 void FormationController::freeSlaves() -
code/branches/formationupdate/src/orxonox/controllers/FormationController.h
r9620 r9621 59 59 static void passivebehaviour(const bool passive); 60 60 static void formationsize(const int size); 61 void setNewMasterWithinFormation();62 61 void setNewMasterWithinFormation(FormationController* newMaster); 63 62 … … 100 99 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage); 101 100 102 /* Just for testing purposes: report the master. */103 101 FormationController* getMaster( void ) { return myMaster_; } 104 FormationController* get This( void ) { return this; }102 FormationController* getController( void ) { return this; } 105 103 FormationController* getSlave( void ) { return this->slaves_.back(); } 106 104 … … 136 134 void takeLeadOfFormation(); 137 135 void loseMasterState(); 136 void setNewMasterWithinFormation(); 138 137 139 138 void freeSlaves(); -
code/branches/formationupdate/src/orxonox/worldentities/pawns/Pawn.cc
r9620 r9621 309 309 310 310 311 /* Two functions to find the slaves of a Pawn 312 * 313 */ 311 // A function to check if this pawn's controller is the master of any formationcontroller 314 312 bool Pawn::hasSlaves() 315 313 { … … 318 316 it != ObjectList<FormationController>::end(); ++it ) 319 317 { 320 // checks if the Pawnhas a slave318 // checks if the pawn's controller has a slave 321 319 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController()) 322 320 return true; … … 325 323 } 326 324 325 // A function that returns a slave of the pawn's controller 327 326 Controller* Pawn::getSlave(){ 328 327 for (ObjectList<FormationController>::iterator it = … … 331 330 { 332 331 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController()) 333 return it->get This();332 return it->getController(); 334 333 } 335 334 return 0; … … 353 352 if (this->getPlayer() && this->getPlayer()->getControllableEntity() == this) 354 353 { 355 356 // Do different things if Pawn is the Master of a Formation 354 // Start to control a new entity if you're the master of a formation 357 355 if(this->hasSlaves()) 358 356 { … … 363 361 slave->setControllableEntity(0); 364 362 365 366 // set new Master 363 // set a new master within the formation 367 364 orxonox_cast<FormationController*>(this->getController())->setNewMasterWithinFormation(orxonox_cast<FormationController*>(slave)); 368 //orxonox_cast<FormationController*>(this->getController())->setNewMasterWithinFormation();369 370 371 /* TO DO: - setNewMasterWithinFormation() with an argument.372 * - set slave as the new master within the formation373 *374 */375 365 376 366 // start to control a slave 377 367 this->getPlayer()->startControl(entity); 378 379 380 368 } 381 369 else
Note: See TracChangeset
for help on using the changeset viewer.