Example #1
0
 public void Update(double TimeElapsed)
 {
     if (Enabled)
     {
         if (mainReservoir.CurrentPressure > mainReservoir.MaximumPressure)
         {
             Enabled     = false;
             LoopStarted = false;
             EndSound.Play(baseCar, false);
             LoopSound.Stop();
         }
         else
         {
             mainReservoir.CurrentPressure += Rate * TimeElapsed;
             if (!LoopStarted && TrainManagerBase.currentHost.InGameTime > TimeStarted + 5.0)
             {
                 LoopStarted = true;
                 LoopSound.Play(baseCar, true);
             }
         }
     }
     else
     {
         if (mainReservoir.CurrentPressure < mainReservoir.MinimumPressure)
         {
             Enabled     = true;
             TimeStarted = TrainManagerBase.currentHost.InGameTime;
             StartSound.Play(baseCar, false);
         }
     }
 }
Example #2
0
 /// <summary>Halts the pass alarm</summary>
 internal void Halt()
 {
     Lit = false;
     if (Sound != null)
     {
         Sound.Stop();
     }
 }
Example #3
0
 /// <summary>Halts the pass alarm</summary>
 public void Halt()
 {
     Lit = false;
     if (Sound != null)
     {
         Sound.Stop();
     }
 }
Example #4
0
        internal void Update(double TimeElapsed)
        {
            if (Enabled)
            {
                if (mainReservoir.CurrentPressure > mainReservoir.MaximumPressure)
                {
                    Enabled     = false;
                    LoopStarted = false;
                    SoundBuffer buffer = EndSound.Buffer;
                    if (buffer != null)
                    {
                        Program.Sounds.PlaySound(buffer, 1.0, 1.0, EndSound.Position, baseCar, false);
                    }

                    buffer = LoopSound.Buffer;
                    if (buffer != null)
                    {
                        LoopSound.Stop();
                    }
                }
                else
                {
                    mainReservoir.CurrentPressure += Rate * TimeElapsed;
                    if (!LoopStarted && Program.CurrentRoute.SecondsSinceMidnight > TimeStarted + 5.0)
                    {
                        LoopStarted = true;
                        SoundBuffer buffer = LoopSound.Buffer;
                        if (buffer != null)
                        {
                            LoopSound.Source = Program.Sounds.PlaySound(buffer, 1.0, 1.0, LoopSound.Position, baseCar, true);
                        }
                    }
                }
            }
            else
            {
                if (mainReservoir.CurrentPressure < mainReservoir.MinimumPressure)
                {
                    Enabled     = true;
                    TimeStarted = Program.CurrentRoute.SecondsSinceMidnight;
                    SoundBuffer buffer = StartSound.Buffer;
                    if (buffer != null)
                    {
                        Program.Sounds.PlaySound(buffer, 1.0, 1.0, StartSound.Position, baseCar, false);
                    }
                }
            }
        }