示例#1
0
        public static SteeringManager SwapInstance(SharedObjects shared, SteeringManager oldInstance)
        {
            if (shared.Vessel == oldInstance.Vessel)
            {
                return(oldInstance);
            }
            if (oldInstance.SubscribedParts.Contains(shared.KSPPart.flightID))
            {
                oldInstance.SubscribedParts.Remove(shared.KSPPart.flightID);
            }
            SteeringManager instance = SteeringManager.DeepCopy(oldInstance, shared);

            if (oldInstance.Enabled)
            {
                if (oldInstance.PartId == shared.KSPPart.flightID)
                {
                    oldInstance.DisableControl();
                    instance.EnableControl(shared);
                    instance.Value = oldInstance.Value;
                }
            }
            return(instance);
        }