Exemple #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();
                });
            }
        }
Exemple #2
0
 public void IncrementPeriod()
 {
     _GamePeriod++;
     if (_GamePeriod > 4)
     {
         _GamePeriod = 1;
     }
     EventMediator.GetEventMediator().OnPeriodChange(_GamePeriod);
 }
 public void DecrementTimeout()
 {
     Seconds--;
     if (Seconds <= 0)
     {
         Seconds = 0;
         EventMediator.GetEventMediator().OnTimeoutClockExpire();
     }
     EventMediator.GetEventMediator().OnTimeoutChange(Seconds);
 }
        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);
 }
 public void IncrementTimeoutSeconds()
 {
     if (Seconds >= 30 && Seconds < 60)
     {
         Seconds = 60;
     }
     else if (Seconds < 30)
     {
         Seconds = 30;
     }
     EventMediator.GetEventMediator().OnTimeoutChange(Seconds);
 }
Exemple #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();
        }
Exemple #8
0
 public void ResetPeriod()
 {
     _GamePeriod = 1;
     EventMediator.GetEventMediator().OnPeriodChange(_GamePeriod);
 }
 public void ResetTimeout()
 {
     Seconds = 0;
     EventMediator.GetEventMediator().OnTimeoutChange(Seconds);
 }
Exemple #10
0
 private static void FireGameClockChangedEvent()
 {
     EventMediator.GetEventMediator().OnClockChange(_GameTime);
 }
Exemple #11
0
 public void ResetAllFouls()
 {
     _GameFouls.Clear();
     EventMediator.GetEventMediator().OnFoulsChange(_GameFouls);
 }
Exemple #12
0
 public void IncrementFouls(Team team)
 {
     _GameFouls.Add(new Foul(team));
     EventMediator.GetEventMediator().OnFoulsChange(_GameFouls);
 }