void GoPath(GoToVertexAction action, FollowMeCar followme, int destinationVertex) { var path = map.FindShortcut(followme.LocationVertex, destinationVertex); for (int i = 0; i < path.Count - 1; i++) { action(followme, path[i + 1]); } }
// ответ private void GoPath(GoToVertexAction action, DeicingCar deicingCar, int destinationVertex) { var path = map.FindShortcut(deicingCar.LocationVertex, destinationVertex); Console.WriteLine($"{deicingCar.DeicingCarID} поедет из {path[0]} в {path[path.Count - 1]}"); for (int i = 0; i < path.Count - 1; i++) { action(deicingCar, path[i + 1]); } }