public void Open(RelayNode nodeIn) { if (show && nodeIn.Equals(this.node)) { Close(); return; } this.node = nodeIn; RTGlobals.targets = new List <Target>(); CBOrV SortNetwork = new CBOrV(Planetarium.fetch.Sun, this.node); SortNetwork.createTargets(ref RTGlobals.targets); RTGlobals.targets.Add(new Target()); RTGlobals.targets[RTGlobals.targets.Count - 1].GUIListname = RTGlobals.targets[RTGlobals.targets.Count - 1].Name; RTGlobals.targets[RTGlobals.targets.Count - 1].color = Color.red; settingNodes = new List <SatSettingNode>(); if (node.IsLoaded) { LoadFromLoaded(); } else { LoadFromUnLoaded(); } this.show = true; }
public CBOrV(CelestialBody inBody, RelayNode inExclNode, string inPrefix) { this.RefBody = inBody; this.RefNode = null; this.Prefix = inPrefix; this.ExclNode = inExclNode; Children = new List <CBOrV>(); if (RefBody.name.Equals("Kerbin")) { Children.Add(new CBOrV(new RelayNode(), Prefix + " ")); } if (RefBody.orbitingBodies.Count > 0) { foreach (CelestialBody b in RefBody.orbitingBodies) { Children.Add(new CBOrV(b, ExclNode, Prefix + " ")); } } foreach (RelayNode n in RTGlobals.network.all) { if (n.MainBodyIs(RefBody) && !ExclNode.Equals(n) && (n.HasDish || n.HasAntenna)) { Children.Add(new CBOrV(n, Prefix + " ")); } } if (Children.Count > 1) { Children.Sort(delegate(CBOrV n1, CBOrV n2) { return(n1.semiMajorAxis.CompareTo(n2.semiMajorAxis)); }); } }
public RelayPath GetCommandPath(RelayNode start) { double compare = double.MaxValue; RelayPath output = null; foreach (RelayNode node in commandStations) { if (!start.Equals(node) && node.HasCommand) { RelayPath tmp = findShortestRelayPath(start, node); if (tmp != null && tmp.Length < compare) { output = tmp; compare = tmp.Length; } } } return(output); }