Changeset 9729
- Timestamp:
- Oct 31, 2013, 10:18:39 PM (11 years ago)
- Location:
- code/trunk/src/orxonox/gametypes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/gametypes/Mission.cc
r9728 r9729 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/command/ConsoleCommand.h" 35 #include "infos/PlayerInfo.h" 35 36 #include "network/Host.h" 36 37 #include "worldentities/pawns/Pawn.h" 38 37 39 38 40 namespace orxonox 39 41 { 40 42 SetConsoleCommand("Mission", "endMission", &Mission::endMission); 43 SetConsoleCommand("Mission", "setLives", &Mission::setLivesWrapper); 41 44 RegisterUnloadableClass(Mission); 42 45 … … 62 65 void Mission::pawnKilled(Pawn* victim, Pawn* killer) 63 66 { 64 if (victim && victim->getPlayer() && this->lives_ == 1)67 if (victim && victim->getPlayer() && victim->getPlayer()->isHumanPlayer() ) 65 68 { 66 this->missionAccomplished_ = false; 67 this->end(); 69 this->lives_--; 70 if (this->lives_ == 0) 71 { 72 this->missionAccomplished_ = false; 73 this->end(); 74 } 68 75 } 69 76 } … … 103 110 } 104 111 } 112 113 void Mission::setLivesWrapper(unsigned int amount) 114 { 115 for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it) 116 {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions! 117 it->setLives(amount); 118 } 119 } 105 120 106 121 -
code/trunk/src/orxonox/gametypes/Mission.h
r9728 r9729 55 55 {this->missionAccomplished_ = acc;} 56 56 static void endMission(bool accomplished); 57 static void setLivesWrapper(unsigned int amount); 57 58 58 59 protected: … … 60 61 bool missionAccomplished_; //<! indicates if player successfully finsihed the mission; 61 62 int lives_; //<! amount of player's lives <-> nr. of retries 62 //Make end() a callback function to the event "END" 63 //or create a console command. 64 63 //<! If the lives_ are set negative -> unlimited lives. 65 64 }; 66 65 }
Note: See TracChangeset
for help on using the changeset viewer.