Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2013, 12:17:59 AM (11 years ago)
Author:
jo
Message:

Merged trunk into branch levelElias to add new features.

Location:
code/branches/levelElias
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/levelElias

  • code/branches/levelElias/src/orxonox/controllers/WaypointPatrolController.cc

    r9667 r9732  
    4242        RegisterObject(WaypointPatrolController);
    4343
    44         this->alertnessradius_ = 500;
     44        this->alertnessradius_ = 500.0f;
     45        this->attackradius_ = 1000.0f;
    4546
    4647        this->patrolTimer_.setTimer(rnd(), true, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy, this)));
     
    5253
    5354        XMLPortParam(WaypointPatrolController, "alertnessradius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues(500.0f);
     55        XMLPortParam(WaypointPatrolController, "attackradius", setAttackRadius, getAttackRadius, xmlelement, mode).defaultValues(1000.0f);
    5456    }
    5557
     
    5961            return;
    6062
    61         if (this->target_)
     63        if (this->target_) //if there is a target, follow it and shoot it, if it is close enough
    6264        {
    6365            this->aimAtTarget();
     
    6668                this->moveToTargetPosition();
    6769
    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))
    6971                this->getControllableEntity()->fire(0);
    7072        }
  • code/branches/levelElias/src/orxonox/controllers/WaypointPatrolController.h

    r9667 r9732  
    5050            inline float getAlertnessRadius() const
    5151                { return this->alertnessradius_; }
     52               
     53            inline void setAttackRadius(float distance)
     54                { this->attackradius_ = distance; }
     55            inline float getAttackRadius() const
     56                { return this->attackradius_; }
    5257
    5358        protected:
    5459            void searchEnemy();
    5560
    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_.
    5763            Timer patrolTimer_;
    5864    };
Note: See TracChangeset for help on using the changeset viewer.