Exemplo n.º 1
0
 public override void ChangeGearDown()
 {
     if (DieselEngines[0].GearBox != null)
     {
         if (DieselEngines[0].GearBox.GearBoxOperation == GearBoxOperation.Semiautomatic)
         {
             DieselEngines[0].GearBox.AutoGearDown();
             GearBoxController.SetValue((float)DieselEngines[0].GearBox.NextGearIndex);
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Restores the type of gearbox, that was forced to
 /// automatic for AI trains
 /// </summary>
 public override void SwitchToPlayerControl()
 {
     foreach (DieselEngine de in DieselEngines)
     {
         if (de.GearBox != null)
         {
             de.GearBox.GearBoxOperation = de.GearBox.OriginalGearBoxOperation;
         }
     }
     if (DieselEngines[0].GearBox != null && GearBoxController != null)
     {
         GearBoxController.CurrentNotch = DieselEngines[0].GearBox.CurrentGearIndex + 1;
         GearboxGearIndex = DieselEngines[0].GearBox.CurrentGearIndex + 1;
         GearBoxController.SetValue((float)GearBoxController.CurrentNotch);
     }
 }
Exemplo n.º 3
0
        //================================================================================================//
        /// <summary>
        /// Set starting conditions  when initial speed > 0
        ///

        public override void InitializeMoving()
        {
            base.InitializeMoving();
            WheelSpeedMpS       = SpeedMpS;
            DynamicBrakePercent = -1;
            if (DieselEngines[0].GearBox != null && GearBoxController != null)
            {
                DieselEngines[0].GearBox.InitializeMoving();
                DieselEngines[0].InitializeMoving();
                if (IsLeadLocomotive())
                {
                    Train.MUGearboxGearIndex      = DieselEngines[0].GearBox.CurrentGearIndex + 1;
                    Train.AITrainGearboxGearIndex = DieselEngines[0].GearBox.CurrentGearIndex + 1;
                }
                GearBoxController.CurrentNotch = Train.MUGearboxGearIndex;
                GearboxGearIndex = DieselEngines[0].GearBox.CurrentGearIndex + 1;
                GearBoxController.SetValue((float)GearBoxController.CurrentNotch);
            }
            ThrottleController.SetValue(Train.MUThrottlePercent / 100);
        }
Exemplo n.º 4
0
        /// <summary>
        /// This function updates periodically the states and physical variables of the locomotive's controllers.
        /// </summary>
        protected override void UpdateControllers(float elapsedClockSeconds)
        {
            base.UpdateControllers(elapsedClockSeconds);

            //Currently the ThrottlePercent is global to the entire train
            //So only the lead locomotive updates it, the others only updates the controller (actually useless)
            if (this.IsLeadLocomotive() || (!AcceptMUSignals))
            {
                if (GearBoxController != null)
                {
                    GearboxGearIndex = (int)GearBoxController.Update(elapsedClockSeconds);
                }
            }
            else
            {
                if (GearBoxController != null)
                {
                    GearBoxController.Update(elapsedClockSeconds);
                }
            }
        }