Ejemplo n.º 1
0
        //public LoiterBehavior(String thisID, String destID, WaypointSequence loiterPattern)
        //{
        //    m_thisID = thisID;
        //    m_destID = destID;
        //    m_destX = 0;
        //    m_destY = 0;
        //    m_loiterPattern = loiterPattern;
        //}

        public LoiterBehavior(String thisID, LocationValue refLoc, WaypointSequence relativeLoiterPattern)
        {
            m_thisID = thisID;
            //m_destID = String.Empty;
            m_referenceLocation     = refLoc;
            m_relativeLoiterPattern = relativeLoiterPattern;
            m_absoluteLoiterPattern = relativeLoiterPattern.ToAbsolute(refLoc);
            m_destWaypoint          = null;
        }
Ejemplo n.º 2
0
        bool ShouldTrack(DDDServerConnection serverConnection, DMView dmView)
        {
            SimObject     me            = dmView.AllObjects[m_thisID];
            LocationValue myLocation    = me.Location;
            SimObject     track         = dmView.AllObjects[m_targetID];
            LocationValue trackLocation = track.Location;

            WaypointSequence absoluteLoiterPattern = m_relativeLoiterPattern.ToAbsolute(trackLocation);
            Waypoint         destWaypoint          = absoluteLoiterPattern.GetWaypointClosestTo(myLocation);

            Double myDis   = BehaviorHelper.Distance(myLocation, trackLocation);
            Double destDis = BehaviorHelper.Distance(destWaypoint.Location, trackLocation);

            if (myDis > (destDis * 2))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }