Changeset 5861 for code/branches/core5/src/orxonox/controllers
- Timestamp:
- Oct 2, 2009, 8:58:27 PM (15 years ago)
- Location:
- code/branches/core5/src/orxonox/controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/orxonox/controllers/ArtificialController.cc
r5738 r5861 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/core5/src/orxonox/controllers/ArtificialController.h
r5738 r5861 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
Note: See TracChangeset
for help on using the changeset viewer.