コード例 #1
0
 private void RetraceCellPath(FaceStarUnit end)
 {
     if (start == end.face)
     {
         result = new List <IImmutableFace>()
         {
             start
         };
     }
     else
     {
         result = new List <IImmutableFace>();
         var current = end;
         while (current.face != start)
         {
             result.Add(current.face);
             current = current.parent;
         }
         result.Add(current.face);
         result.Reverse();
     }
 }
コード例 #2
0
        private void FindFacePath()
        {
            //TODO: Optimization
            while (openSet.Any)
            {
                current       = openSet.Min;
                currentCenter = current.face.CalculateCenter();

                openSet.Remove(current);
                closeSet.Add(current.face);

                if (current.face != end)
                {
                    HandleNeighbour(current.face.ABNeighbour);
                    HandleNeighbour(current.face.BCNeighbour);
                    HandleNeighbour(current.face.CANeighbour);
                }
                else
                {
                    RetraceCellPath(current);
                    return;
                }
            }
        }