public static IReadOnlyCollection <ICelestialSystem> GetSiblings(this ICelestialSystem root) { if (root.Parent == null) { return(new List <ICelestialSystem>()); } return(root.Parent.Children.Except(root).ToList()); }
private static Station CreateStation(ICelestialSystem system) { return(new Station($"{system.CentralBody.Name} Station", system, 200000.Kilometer() + system.CentralBody.Radius * 100) { OfferedItems = new List <MarketplaceItem> { new MarketplaceItem(new ItemStack(new LiquidElementItem(Elements.Hydrogen), 5000), new decimal(0.11)), new MarketplaceItem(new ItemStack(new LiquidElementItem(Elements.Oxygen), 5000), new decimal(1.8)), }, RequestedItems = new List <MarketplaceItem> { new MarketplaceItem(new ItemStack(new LiquidElementItem(Elements.Hydrogen), 5000), new decimal(0.1)), new MarketplaceItem(new ItemStack(new LiquidElementItem(Elements.Oxygen), 5000), new decimal(1.6)) } }); }
public static ICelestialSystem GetDescendent(this ICelestialSystem root, string name) { ICelestialSystem current = root; foreach (var child in current.Children) { if (child.Name == name) { return(child); } var descendent = child.GetDescendent(name); if (descendent != null) { return(descendent); } } return(null); }
public Station(string name, ICelestialSystem celestialSystem, double parkingOrbit) { Name = name; CelestialSystem = celestialSystem; ParkingOrbit = parkingOrbit; }