Esempio n. 1
0
        public static void Sound()
        {
            try
            {
                var generator = new SignalGenerator();
                generator.Type      = SignalGeneratorType.SawTooth;
                generator.Frequency = 2500;

                var gameHorn = new WaveOut();
                gameHorn.Init(generator.ToWaveProvider());

                Task.Run(() =>
                {
                    EventMediator.GetEventMediator().OnGameClockSounding();
                    gameHorn.Play();
                    Thread.Sleep(2000);
                    gameHorn.Stop();
                    EventMediator.GetEventMediator().OnGameClockSounded();
                });
            }
            catch (System.Exception)
            {
                SoundPlayer player = new SoundPlayer {
                    SoundLocation = @"C:\Windows\media\Windows Ringout.wav"
                };
                Task.Run(() =>
                {
                    player.PlayLooping();
                    Thread.Sleep(2000);
                    player.Stop();
                });
            }
        }
Esempio n. 2
0
 public void IncrementPeriod()
 {
     _GamePeriod++;
     if (_GamePeriod > 4)
     {
         _GamePeriod = 1;
     }
     EventMediator.GetEventMediator().OnPeriodChange(_GamePeriod);
 }
Esempio n. 3
0
 public void DecrementTimeout()
 {
     Seconds--;
     if (Seconds <= 0)
     {
         Seconds = 0;
         EventMediator.GetEventMediator().OnTimeoutClockExpire();
     }
     EventMediator.GetEventMediator().OnTimeoutChange(Seconds);
 }
Esempio n. 4
0
        public void DecrementFouls(Team team)
        {
            Foul foul = _GameFouls.FirstOrDefault(x => x.Team == team);

            if (foul != null)
            {
                _GameFouls.Remove(foul);
            }
            EventMediator.GetEventMediator().OnFoulsChange(_GameFouls);
        }
 public void ChangePossession()
 {
     if (Team == Team.Away)
     {
         Team = Team.Home;
     }
     else
     {
         Team = Team.Away;
     }
     EventMediator.GetEventMediator().OnPossessionChange(this.Team);
 }
Esempio n. 6
0
 public void IncrementTimeoutSeconds()
 {
     if (Seconds >= 30 && Seconds < 60)
     {
         Seconds = 60;
     }
     else if (Seconds < 30)
     {
         Seconds = 30;
     }
     EventMediator.GetEventMediator().OnTimeoutChange(Seconds);
 }
Esempio n. 7
0
        public void DecrementGameTimeByTenth()
        {
            _GameTime.Tenths--;
            if (_GameTime.Tenths < 0)
            {
                _GameTime.Tenths = 9;
                _GameTime.Seconds--;
            }
            if (_GameTime.Seconds < 0)
            {
                _GameTime.Seconds = 59;
                _GameTime.Minutes--;
            }
            if (_GameTime.Minutes < 0)
            {
                _GameTime.Tenths  = 0;
                _GameTime.Seconds = 0;
                _GameTime.Minutes = 0;

                EventMediator.GetEventMediator().OnGameClockExpire();
            }
            FireGameClockChangedEvent();
        }
Esempio n. 8
0
 public void ResetPeriod()
 {
     _GamePeriod = 1;
     EventMediator.GetEventMediator().OnPeriodChange(_GamePeriod);
 }
Esempio n. 9
0
 public void ResetTimeout()
 {
     Seconds = 0;
     EventMediator.GetEventMediator().OnTimeoutChange(Seconds);
 }
Esempio n. 10
0
 private static void FireGameClockChangedEvent()
 {
     EventMediator.GetEventMediator().OnClockChange(_GameTime);
 }
Esempio n. 11
0
 public void ResetAllFouls()
 {
     _GameFouls.Clear();
     EventMediator.GetEventMediator().OnFoulsChange(_GameFouls);
 }
Esempio n. 12
0
 public void IncrementFouls(Team team)
 {
     _GameFouls.Add(new Foul(team));
     EventMediator.GetEventMediator().OnFoulsChange(_GameFouls);
 }