示例#1
0
        public static void Restore(IController controller, BinaryReader inf)
        {
            if (!inf.ReadBoolean())
            {
                return;
            }

            switch ((ControllerTypes)inf.ReadInt32())
            {
            case ControllerTypes.MSTSNotchController:
                if (controller == null)
                {
                    controller = new MSTSNotchController();
                }
                ((MSTSNotchController)controller).Restore(inf);
                break;

            case ControllerTypes.BrakeController:
                ((ScriptedBrakeController)controller).Restore(inf);
                break;

            default:
                throw new InvalidDataException("Invalid controller type");
            }
        }
示例#2
0
 public override void Initialize()
 {
     NotchController = new MSTSNotchController(Notches());
     NotchController.SetValue(CurrentValue());
     NotchController.IntermediateValue = CurrentValue();
     NotchController.MinimumValue      = MinimumValue();
     NotchController.MaximumValue      = MaximumValue();
     NotchController.StepSize          = StepSize();
 }
示例#3
0
 public override void Initialize()
 {
     NotchController = new MSTSNotchController(Notches());
     NotchController.SetValue(CurrentValue());
     NotchController.IntermediateValue = CurrentValue();
     NotchController.MinimumValue      = MinimumValue();
     NotchController.MaximumValue      = MaximumValue();
     NotchController.StepSize          = StepSize();
     BrakeControllerInitialised        = false; // set to false so that the PreviousNotchPosition value can be initialised around the first update loop
 }
        public MSTSNotchController(MSTSNotchController other)
        {
            CurrentValue      = other.CurrentValue;
            IntermediateValue = other.IntermediateValue;
            MinimumValue      = other.MinimumValue;
            MaximumValue      = other.MaximumValue;
            StepSize          = other.StepSize;
            CurrentNotch      = other.CurrentNotch;

            foreach (MSTSNotch notch in other.Notches)
            {
                Notches.Add(notch.Clone());
            }
        }