Changeset 5935 for code/branches/pickup/src/orxonox/controllers
- Timestamp:
- Oct 13, 2009, 5:05:17 PM (15 years ago)
- Location:
- code/branches/pickup
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup
- Property svn:mergeinfo changed
-
code/branches/pickup/src/orxonox/controllers/AIController.cc
r5781 r5935 44 44 RegisterObject(AIController); 45 45 46 this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&AIController::action)));46 this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&AIController::action, this))); 47 47 } 48 48 -
code/branches/pickup/src/orxonox/controllers/AIController.h
r5781 r5935 50 50 51 51 private: 52 Timer <AIController>actionTimer_;52 Timer actionTimer_; 53 53 }; 54 54 } -
code/branches/pickup/src/orxonox/controllers/ArtificialController.cc
r5781 r5935 46 46 this->bHasTargetPosition_ = false; 47 47 this->targetPosition_ = Vector3::ZERO; 48 49 this->target_.setCallback(createFunctor(&ArtificialController::targetDied, this)); 48 50 } 49 51 … … 162 164 } 163 165 164 void ArtificialController::destroyedPawn(Pawn* ship) 165 { 166 if (ship == this->target_) 167 { 168 this->forgetTarget(); 169 this->searchRandomTargetPosition(); 170 } 166 void ArtificialController::abandonTarget(Pawn* target) 167 { 168 if (target == this->target_) 169 this->targetDied(); 170 } 171 172 void ArtificialController::targetDied() 173 { 174 this->forgetTarget(); 175 this->searchRandomTargetPosition(); 171 176 } 172 177 -
code/branches/pickup/src/orxonox/controllers/ArtificialController.h
r5781 r5935 33 33 34 34 #include "util/Math.h" 35 #include "interfaces/PawnListener.h"36 35 #include "Controller.h" 37 36 38 37 namespace orxonox 39 38 { 40 class _OrxonoxExport ArtificialController : public Controller , public PawnListener39 class _OrxonoxExport ArtificialController : public Controller 41 40 { 42 41 public: 43 42 ArtificialController(BaseObject* creator); 44 43 virtual ~ArtificialController(); 45 46 v irtual void destroyedPawn(Pawn* pawn);44 45 void abandonTarget(Pawn* target); 47 46 48 47 protected: 48 void targetDied(); 49 49 50 void moveToPosition(const Vector3& target); 50 51 void moveToTargetPosition(); … … 65 66 bool bHasTargetPosition_; 66 67 Vector3 targetPosition_; 67 Pawn*target_;68 WeakPtr<Pawn> target_; 68 69 bool bShooting_; 69 70 -
code/branches/pickup/src/orxonox/controllers/HumanController.cc
r5781 r5935 36 36 #include "infos/PlayerInfo.h" 37 37 #include "overlays/Map.h" 38 #include "graphics/Camera.h" 39 #include "sound/SoundManager.h" 40 #include "Radar.h" 41 #include "Scene.h" 38 42 39 43 namespace orxonox … … 56 60 SetConsoleCommand(HumanController, dropItems, true); 57 61 SetConsoleCommand(HumanController, useItem, true); 62 SetConsoleCommand(HumanController, cycleNavigationFocus, true); 63 SetConsoleCommand(HumanController, releaseNavigationFocus, true); 58 64 59 65 CreateUnloadableFactory(HumanController); … … 71 77 { 72 78 HumanController::localController_s = 0; 79 } 80 81 void HumanController::tick(float dt) 82 { 83 if (GameMode::playsSound() && HumanController::localController_s && HumanController::localController_s->controllableEntity_) 84 { 85 // Update sound listener 86 Camera* camera = HumanController::localController_s->controllableEntity_->getCamera(); 87 if (camera) 88 { 89 SoundManager::getInstance().setListenerPosition(camera->getWorldPosition()); 90 SoundManager::getInstance().setListenerOrientation(camera->getWorldOrientation()); 91 } 92 else 93 COUT(3) << "HumanController, Warning: Using a ControllableEntity without Camera" << std::endl; 94 } 73 95 } 74 96 … … 200 222 return NULL; 201 223 } 224 225 void HumanController::cycleNavigationFocus() 226 { 227 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 228 HumanController::localController_s->controllableEntity_->getScene()->getRadar()->cycleFocus(); 229 } 230 231 void HumanController::releaseNavigationFocus() 232 { 233 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 234 HumanController::localController_s->controllableEntity_->getScene()->getRadar()->releaseFocus(); 235 } 202 236 } -
code/branches/pickup/src/orxonox/controllers/HumanController.h
r5781 r5935 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 #include "tools/interfaces/Tickable.h" 33 35 #include "Controller.h" 34 36 35 37 namespace orxonox 36 38 { 37 class _OrxonoxExport HumanController : public Controller 39 class _OrxonoxExport HumanController : public Controller, public Tickable 38 40 { 39 41 public: 40 42 HumanController(BaseObject* creator); 41 43 virtual ~HumanController(); 44 45 virtual void tick(float dt); 42 46 43 47 static void moveFrontBack(const Vector2& value); … … 58 62 static void dropItems(); 59 63 static void useItem(); 64 static void cycleNavigationFocus(); 65 static void releaseNavigationFocus(); 60 66 61 67 static void suicide(); -
code/branches/pickup/src/orxonox/controllers/WaypointController.cc
r5781 r5935 50 50 { 51 51 for (size_t i = 0; i < this->waypoints_.size(); ++i) 52 delete this->waypoints_[i];52 this->waypoints_[i]->destroy(); 53 53 } 54 54 } -
code/branches/pickup/src/orxonox/controllers/WaypointPatrolController.cc
r5781 r5935 45 45 this->alertnessradius_ = 500; 46 46 47 this->patrolTimer_.setTimer(rnd(), true, this, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy)));47 this->patrolTimer_.setTimer(rnd(), true, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy, this))); 48 48 } 49 49 -
code/branches/pickup/src/orxonox/controllers/WaypointPatrolController.h
r5781 r5935 61 61 int team_; 62 62 float alertnessradius_; 63 Timer <WaypointPatrolController>patrolTimer_;63 Timer patrolTimer_; 64 64 }; 65 65 }
Note: See TracChangeset
for help on using the changeset viewer.