Exemplo n.º 1
0
        public void Start(DDDServerConnection serverConnection, DMView dmView)
        {
            m_dmView = dmView;

            SimObject     me         = dmView.AllObjects[m_thisID];
            LocationValue myLocation = me.Location;

            m_destWaypoint = m_absoluteLoiterPattern.GetWaypointClosestTo(myLocation);
            serverConnection.SendMoveObjectRequest(m_thisID, m_destWaypoint.Location, 1);
        }
Exemplo n.º 2
0
        void StartLoiter(DDDServerConnection serverConnection, DMView dmView)
        {
            SimObject     me            = dmView.AllObjects[m_thisID];
            LocationValue myLocation    = me.Location;
            SimObject     track         = dmView.AllObjects[m_targetID];
            LocationValue trackLocation = track.Location;

            m_absoluteLoiterPattern = m_relativeLoiterPattern.ToAbsolute(trackLocation);
            m_destWaypoint          = m_absoluteLoiterPattern.GetWaypointClosestTo(myLocation);
            m_relativeLoiterPattern.NextWaypointIndex    = m_absoluteLoiterPattern.NextWaypointIndex;
            m_relativeLoiterPattern.CurrentWaypointIndex = m_absoluteLoiterPattern.CurrentWaypointIndex;
            serverConnection.SendMoveObjectRequest(m_thisID, m_destWaypoint.Location, 1);
        }
Exemplo n.º 3
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);
            }
        }