Ejemplo n.º 1
0
        /// <summary>
        /// Use for a 'step by step' search only. This method is alternate to SearchPath.
        /// The algorithm must have been initialize before.
        /// </summary>
        /// <exception cref="InvalidOperationException">You must initialize AStar before using NextStep().</exception>
        /// <returns>'true' unless the search ended.</returns>
        public bool NextStep()
        {
            if (!Initialized)
            {
                throw new InvalidOperationException("You must initialize AStar before launching the algorithm.");
            }
            if (_Open.Count == 0)
            {
                return(false);
            }
            _NbIterations++;

            int   IndexMin  = _Open.IndexOfMin();
            Track BestTrack = (Track)_Open[IndexMin];

            _Open.RemoveAt(IndexMin);
            if (BestTrack.Succeed)
            {
                _LeafToGoBackUp = BestTrack;
                _Open.Clear();
            }
            else
            {
                Propagate(BestTrack);
                _Closed.Add(BestTrack);
            }
            return(_Open.Count > 0);
        }
Ejemplo n.º 2
0
 public void RemoveEndwith(Point2 _site)
 {
     for (int i = 0; i < m_sweepRegions.Count; i++)
     {
         var elementI = m_sweepRegions[i];
         if (elementI.m_end == _site)
         {
             m_sweepRegions.RemoveAt(i);
             SlopeRegion.Pool.GiveBack(elementI);
             i--;
         }
     }
 }