RemoteTech.FlightComputer.FlightComputer.OnVesselSwitching C# (CSharp) Method

OnVesselSwitching() private method

Called when there's a vessel switch, switching from `fromVessel` to `toVessel`.
private OnVesselSwitching ( Vessel fromVessel, Vessel toVessel ) : void
fromVessel Vessel The vessel we switch from.
toVessel Vessel The vessel we're switching to.
return void
        private void OnVesselSwitching(Vessel fromVessel, Vessel toVessel)
        {
            RTLog.Notify("OnVesselSwitching - from: " + (fromVessel != null ? fromVessel.vesselName : "N/A") + " to: " + toVessel.vesselName);

            if(fromVessel != null)
            {
                // remove flight code controls.
                fromVessel.OnFlyByWire -= OnFlyByWirePre;
                fromVessel.OnFlyByWire -= OnFlyByWirePost;
            }

            _flightComputerWindow?.Hide();
        }