public void Init(PlanetData start, PlanetData target, int shipCount, int currentDay) { StartPlanet = start; TargetPlanet = target; ShipCount = shipCount; if (start == null) { Owner = null; ArrivalTime = 0; } else { Owner = start.Owner; ArrivalTime = (int)System.Math.Round(currentDay + start.GetSurfaceDistance(target) / TravelSpeed); TravelTime = GetTravelTime(start, target); ArrivalTime = TravelTime + currentDay; } }
public static int GetTravelTime(PlanetData start, PlanetData target) { return System.Math.Max((int)System.Math.Round(start.GetSurfaceDistance(target) / TravelSpeed), 1); }