/// <summary> /// Generate the moving path for that position /// </summary> /// <param name="position"></param> /// <returns></returns> public FDMovePath GetPath(FDPosition position) { if (!directionedScope.ContainsKey(position) || skipPositions.Contains(position)) { return(null); } FDMovePath path = new FDMovePath(); FDPosition current = position; FDPosition next = directionedScope[current]; int lastDirection = -1; while (next != null) { int direction = next.IsNextToDirection(current); if (lastDirection < 0 || direction != lastDirection) { path.InsertToHead(current); } lastDirection = direction; current = next; next = directionedScope[current]; } return(path); }
/// <summary> /// Single one position for move path /// </summary> /// <param name="position"></param> /// <returns></returns> public static FDMovePath Create(FDPosition position) { FDMovePath movePath = new FDMovePath(); movePath.Vertexes.Add(position); return(movePath); }