- Timestamp:
- Dec 11, 2015, 3:16:48 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
r10958 r10968 53 53 this->bDefaultPatrol_ = true; 54 54 this->bDefaultFightAll_ = true; 55 this->stop_ = false;56 55 RegisterObject(ActionpointController); 57 56 … … 75 74 void ActionpointController::tick(float dt) 76 75 { 77 if (!this || !this->getControllableEntity() || !this->isActive() || this->stop_)76 if (!this || !this->getControllableEntity() || !this->isActive()) 78 77 return; 79 78 … … 733 732 if (!this || !this->getControllableEntity()) 734 733 return; 735 736 //if (this->action_ != Action::FIGHT && this->action_ != Action::FIGHTALL) 737 { 738 if (!this->target_ || (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_)) 739 { 740 if (!this || !this->getControllableEntity()) 741 return; 742 Pawn* newTarget = this->closestTarget(); 743 if ( newTarget && 744 CommonController::distance (this->getControllableEntity(), static_cast<ControllableEntity*>(newTarget)) 745 <= this->attackRange_ ) 746 { 747 if (!this || !this->getControllableEntity()) 748 return; 749 this->setTarget(newTarget); 750 if (this->bLoop_ && !this->bPatrolling_) 751 { 752 Point p = { Action::FIGHT, "", Vector3::ZERO, true }; 753 this->loopActionpoints_.push_back(p); 754 } 755 else if (!this->bPatrolling_) 756 { 757 //orxout (internal_error) << "found new target " << CommonController::getName(newTarget) <<endl; 758 Point p = { Action::FIGHT, "", Vector3::ZERO, false }; 759 this->parsedActionpoints_.push_back(p); 760 } 761 this->bPatrolling_ = true; 762 this->executeActionpoint(); 763 } 734 735 if (!this->target_ || (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_)) 736 { 737 if (!this || !this->getControllableEntity()) 738 return; 739 Pawn* newTarget = this->closestTarget(); 740 if ( newTarget && 741 CommonController::distance (this->getControllableEntity(), static_cast<ControllableEntity*>(newTarget)) 742 <= this->attackRange_ ) 743 { 744 if (!this || !this->getControllableEntity()) 745 return; 746 this->setTarget(newTarget); 747 if (this->bLoop_ && !this->bPatrolling_) 748 { 749 Point p = { Action::FIGHT, "", Vector3::ZERO, true }; 750 this->loopActionpoints_.push_back(p); 751 } 752 else if (!this->bPatrolling_) 753 { 754 Point p = { Action::FIGHT, "", Vector3::ZERO, false }; 755 this->parsedActionpoints_.push_back(p); 756 } 757 this->bPatrolling_ = true; 758 this->executeActionpoint(); 764 759 } 765 760 }
Note: See TracChangeset
for help on using the changeset viewer.