public void CreateHyperlanes() { Console.WriteLine("Started Hyperlanes..."); List <Hyperlane> existingLanes = new List <Hyperlane>(); StarSystem sys1; StarSystem sys2; foreach (StarSystem system in systems) { foreach (StarSystem system2 in systems) { if (system != system2) { double length = Math.Sqrt(Math.Pow(system.posX - system2.posX, 2) + Math.Pow(system.posY - system2.posY, 2)); if (length <= 300 && length >= 10) { sys1 = system; sys2 = system2; Hyperlane currentLane = new Hyperlane(sys1, sys2, Math.Round(length, 2)); hyperLanes.Add(currentLane); //Console.WriteLine(sys1.name + " connected to " + sys2.name + " via hyperlink"); } } } } }
public void AddHyperlane(Hyperlane hyperlane) { db.Insert(hyperlane); }