/// <summary>
 /// Raise a circular orbit by the specified percent
 /// - only on-rail is implemented
 /// </summary>
 /// <param name="percentRaise"></param>
 private void NewCircularOrbit(float percentRaise)
 {
     if (onRails)
     {
         KeplerSequence keplerSeq = spaceship.GetComponent <KeplerSequence>();
         OrbitUniversal orbitU    = keplerSeq.GetCurrentOrbit();
         // check orbit is circular
         if (orbitU.eccentricity < 1E-2)
         {
             // circular, ok to proceed
             OrbitData fromOrbit = new OrbitData(orbitU);
             OrbitData toOrbit   = new OrbitData(fromOrbit);
             toOrbit.a = percentRaise * fromOrbit.a;
             const bool    rendezvous  = false;
             OrbitTransfer hohmannXfer = new HohmannXfer(fromOrbit, toOrbit, rendezvous);
             keplerSeq.RemoveFutureSegments();
             keplerSeq.AddManeuvers(hohmannXfer.GetManeuvers());
         }
     }
     else
     {
         // assume we're in orbit around the moon
         OrbitData orbitData = new OrbitData();
         orbitData.SetOrbitForVelocity(spaceship, moonBody);
         OrbitData toOrbit = new OrbitData(orbitData);
         toOrbit.a = percentRaise * orbitData.a;
         const bool    rendezvous  = false;
         OrbitTransfer hohmannXfer = new HohmannXfer(orbitData, toOrbit, rendezvous);
         ge.AddManeuvers(hohmannXfer.GetManeuvers());
     }
 }
 /// <summary>
 /// Circularize around Moon
 /// - currently only onRails is implemented
 /// </summary>
 private void CircularizeAroundMoon()
 {
     // check ship is on segment where it near Moon
     if (onRails)
     {
         KeplerSequence keplerSeq = spaceship.GetComponent <KeplerSequence>();
         OrbitUniversal orbitU    = keplerSeq.GetCurrentOrbit();
         if (orbitU.centerNbody == moonBody)
         {
             // in orbit around the moon - do circularization
             OrbitData     orbitData       = new OrbitData(orbitU);
             OrbitTransfer circularizeXfer = new CircularizeXfer(orbitData);
             keplerSeq.RemoveFutureSegments();
             keplerSeq.AddManeuvers(circularizeXfer.GetManeuvers());
         }
     }
     else
     {
         // assume we're in orbit around the moon
         OrbitData orbitData = new OrbitData();
         orbitData.SetOrbitForVelocity(spaceship, moonBody);
         OrbitTransfer circularizeXfer = new CircularizeXfer(orbitData);
         ge.AddManeuvers(circularizeXfer.GetManeuvers());
     }
 }
 /// <summary>
 /// Do hand off from one center to a new center in the OrbitUniversal class.
 /// </summary>
 /// <param name="newObject"></param>
 /// <param name="oldObject"></param>
 public void OnNewInfluencer(NBody newObject, NBody oldObject)
 {
     if (keplerSeq != null)
     {
         orbitU = keplerSeq.GetCurrentOrbit();
     }
     orbitU.SetNewCenter(newObject);
     if (orbitPredictor != null)
     {
         orbitPredictor.SetCenterObject(newObject.gameObject);
     }
 }
 private void WarnAboutKeplerSeq(OrbitUniversal orbitU)
 {
     // when playing warn user if OrbitU attached to NBody is being used or not
     if (EditorApplication.isPlaying)
     {
         KeplerSequence ks = orbitU.GetComponent <KeplerSequence>();
         if (ks != null)
         {
             if (ks.GetCurrentOrbit() != orbitU)
             {
                 EditorGUILayout.LabelField("OrbitUniversal is not current orbit in Kepler sequence!",
                                            EditorStyles.boldLabel);
             }
         }
     }
 }
    /// <summary>
    /// Raise a circular orbit by the specified percent
    /// - only on-rail is implemented
    /// </summary>
    /// <param name="percentRaise"></param>
    private void NewCircularOrbit(float percentRaise)
    {
        KeplerSequence keplerSeq = spaceship.GetComponent <KeplerSequence>();
        OrbitUniversal orbitU    = keplerSeq.GetCurrentOrbit();

        // check orbit is circular
        if (orbitU.eccentricity < 1E-2)
        {
            // circular, ok to proceed
            OrbitData fromOrbit = new OrbitData(orbitU);
            OrbitData toOrbit   = new OrbitData(fromOrbit);
            toOrbit.a = percentRaise * fromOrbit.a;
            const bool    rendezvous  = false;
            OrbitTransfer hohmannXfer = new HohmannXfer(fromOrbit, toOrbit, rendezvous);
            keplerSeq.RemoveFutureSegments();
            keplerSeq.AddManeuvers(hohmannXfer.GetManeuvers());
        }
    }