/// <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); }