private MovementPath Find(Point start, Point end) { MovementPath path = new MovementPath(); Point current = start; while (current != end) { if (end.X > current.X) { current.X++; } else if (end.X < current.X) { current.X--; } if (end.Y > current.Y) { current.Y++; } else if (end.Y < current.Y) { current.Y--; } path.Cells.Add(current); } return(path); }
private MovementPath Find(Point start, Point end) { MovementPath path = new MovementPath(); Point current = start; while (current != end) { if (end.X > current.X) { current.X++; } else if (end.X < current.X) { current.X--; } if (end.Y > current.Y) { current.Y++; } else if (end.Y < current.Y) { current.Y--; } path.Cells.Add(current); } return path; }