private void CheckIntercepts() { // check for intercepts // List them in a dropdown and allow user to click an intercept to select it intercepts = MarkIntercepts(spaceship, target); if (intercepts.Count > 0) { InactivatePanels(); interceptPanel.SetActive(true); // populate the intercept drop down. interceptSelectionPanel.Clear(); int count = 0; // With long trajectory times can get same point on multiple orbits. // Just take the first two intercepts foreach (TrajectoryData.Intercept t in intercepts) { if (count >= 2) { break; } int _count = count++; string label = string.Format("@t={0:00.0}\ndV={1:00.0} dT={2:00.0}", t.tp1.t, t.dV, t.dT); interceptSelectionPanel.AddButton(label, () => InterceptSelected(_count)); // t.Log(); } } else { InactivatePanels(); manualPanel.SetActive(true); } }
private void SetObjectiveOptions(NBody[] targets) { int count = 0; objectiveSelectionPanel.Clear(); foreach (NBody nbody in targets) { int _count = count++; objectiveSelectionPanel.AddButton(nbody.gameObject.name, () => ObjectiveSelected(_count)); } }
private void CalculateTransfers() { // Find xfer choices and present to user transferCalc = new TransferCalc(spaceship.GetNBody(), target, centralMass); transfers = transferCalc.FindTransfers(); orbitSelectionPanel.Clear(); int count = 0; foreach (OrbitTransfer t in transfers) { // need a new variable for each lambda int _count = count++; orbitSelectionPanel.AddButton(t.ToString(), () => OrbitSelected(_count)); } }