- Timestamp:
- Dec 15, 2008, 1:38:02 AM (16 years ago)
- Location:
- code/branches/objecthierarchy2/src/orxonox/objects/controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy2/src/orxonox/objects/controllers/HumanController.cc
r2254 r2462 33 33 #include "core/ConsoleCommand.h" 34 34 #include "objects/worldentities/ControllableEntity.h" 35 #include "objects/worldentities/pawns/Pawn.h" 36 #include "objects/gametypes/Gametype.h" 35 37 36 38 namespace orxonox … … 48 50 SetConsoleCommand(HumanController, use, true); 49 51 SetConsoleCommand(HumanController, switchCamera, true); 52 SetConsoleCommand(HumanController, suicide, true); 53 SetConsoleCommand(HumanController, addBots, true).defaultValues(1); 54 SetConsoleCommand(HumanController, killBots, true).defaultValues(0); 50 55 51 56 CreateUnloadableFactory(HumanController); … … 136 141 HumanController::localController_s->controllableEntity_->switchCamera(); 137 142 } 143 144 void HumanController::suicide() 145 { 146 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 147 { 148 Pawn* pawn = dynamic_cast<Pawn*>(HumanController::localController_s->controllableEntity_); 149 if (pawn) 150 pawn->kill(); 151 } 152 } 153 154 void HumanController::addBots(unsigned int amount) 155 { 156 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_ && HumanController::localController_s->controllableEntity_->getGametype()) 157 HumanController::localController_s->controllableEntity_->getGametype()->addBots(amount); 158 } 159 160 void HumanController::killBots(unsigned int amount) 161 { 162 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_ && HumanController::localController_s->controllableEntity_->getGametype()) 163 HumanController::localController_s->controllableEntity_->getGametype()->killBots(amount); 164 } 138 165 } -
code/branches/objecthierarchy2/src/orxonox/objects/controllers/HumanController.h
r2254 r2462 59 59 static void switchCamera(); 60 60 61 static void suicide(); 62 63 static void addBots(unsigned int amount); 64 static void killBots(unsigned int amount = 0); 65 61 66 private: 62 67 static HumanController* localController_s;
Note: See TracChangeset
for help on using the changeset viewer.