Changeset 9732 for code/branches/levelElias/src/orxonox/controllers
- Timestamp:
- Nov 1, 2013, 12:17:59 AM (11 years ago)
- Location:
- code/branches/levelElias
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/levelElias
- Property svn:mergeinfo changed
/code/trunk (added) merged: 9703,9716,9728-9730
- Property svn:mergeinfo changed
-
code/branches/levelElias/src/orxonox/controllers/WaypointPatrolController.cc
r9667 r9732 42 42 RegisterObject(WaypointPatrolController); 43 43 44 this->alertnessradius_ = 500; 44 this->alertnessradius_ = 500.0f; 45 this->attackradius_ = 1000.0f; 45 46 46 47 this->patrolTimer_.setTimer(rnd(), true, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy, this))); … … 52 53 53 54 XMLPortParam(WaypointPatrolController, "alertnessradius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues(500.0f); 55 XMLPortParam(WaypointPatrolController, "attackradius", setAttackRadius, getAttackRadius, xmlelement, mode).defaultValues(1000.0f); 54 56 } 55 57 … … 59 61 return; 60 62 61 if (this->target_) 63 if (this->target_) //if there is a target, follow it and shoot it, if it is close enough 62 64 { 63 65 this->aimAtTarget(); … … 66 68 this->moveToTargetPosition(); 67 69 68 if (this->getControllableEntity() && this->isCloseAtTarget( 1000) && this->isLookingAtTarget(math::pi / 20.0f))70 if (this->getControllableEntity() && this->isCloseAtTarget(this->attackradius_) && this->isLookingAtTarget(math::pi / 20.0f)) 69 71 this->getControllableEntity()->fire(0); 70 72 } -
code/branches/levelElias/src/orxonox/controllers/WaypointPatrolController.h
r9667 r9732 50 50 inline float getAlertnessRadius() const 51 51 { return this->alertnessradius_; } 52 53 inline void setAttackRadius(float distance) 54 { this->attackradius_ = distance; } 55 inline float getAttackRadius() const 56 { return this->attackradius_; } 52 57 53 58 protected: 54 59 void searchEnemy(); 55 60 56 float alertnessradius_; 61 float alertnessradius_; //!< Enemies within this radius are being followed and shot. 62 float attackradius_; //!< Enemies only get shot, if they are within the attackradius_. 57 63 Timer patrolTimer_; 58 64 };
Note: See TracChangeset
for help on using the changeset viewer.