Exemple #1
0
 /// <summary>
 /// Событие тика таймера
 /// </summary>
 private void Timer_Tick(object sender, EventArgs e)
 {
     if (TotalSeconds - 1 >= 0)
     {
         TotalSeconds--;
     }
     if (TotalSeconds == 0)
     {
         timer.Stop();
         TimerStop.Invoke();
     }
     TimerTick.Invoke();
 }
Exemple #2
0
        public void TimerStart()
        {
            MyEventArgs eventArgs = new MyEventArgs();

            for (int i = 0; i < TimerTime; i++)
            {
                eventArgs.SetRemainigTime(TimerTime - i);
                RemainingTime?.Invoke(this, eventArgs);

                Thread.Sleep(1000);
            }
            TimerStop?.Invoke(this, null);
        }
Exemple #3
0
        public void EggBroken(Egg brokenEgg)
        {
            TimerStop?.Invoke(this, new EventArgs());
            BrokenEggs++;

            foreach (Egg eg in _countOfEggs)
            {
                if (eg != brokenEgg)
                {
                    eg.timer.Stop();
                    DeleteEgg?.Invoke(eg, new EventArgs());
                }
            }

            LifeActivate?.Invoke(this, new EventArgs());
        }
Exemple #4
0
        public void EggMove(object sender, EventArgs e)
        {
            if (_currentFrame == FallFrameIndex)
            {
                ReadyToCatch?.Invoke(this, new EventArgs());
            }

            if (_currentFrame == EndOfWayIndex)
            {
                TimerStop?.Invoke(this, new EventArgs());
                timer.Stop();
                AnimationEnd?.Invoke(this, new EventArgs());
                return;
            }

            EggsDeactivate();

            EggWay[_currentFrame].Visibility = Visibility.Visible;
            _currentFrame++;
        }
Exemple #5
0
        private void SplashScreen_Shown(object sender, EventArgs e)
        {
            //creating the timer that will run for 3 seconds
            timer = new Timer
            {
                Interval = 1000
            };

            timer.Start();

            //event that will run when the timer stops
            stopping = new TimerStop((object send, EventArgs args) =>
            {
                timer.Stop();
                LoadingScreen form = new LoadingScreen();
                this.Hide();
                form.ShowDialog();
                this.Close();
            });

            //calling the stopping event
            timer.Tick += new EventHandler(stopping);
        }
Exemple #6
0
 // stops countdown
 public void StopTimer()
 {
     active = false;
     TimerStop.Invoke();
     FindObjectOfType <AudioManager>().Play("Buzzer");
 }
Exemple #7
0
 public void EndGame()
 {
     TimerStop?.Invoke(this, new EventArgs());
     RemoveAllEggs();
 }
Exemple #8
0
 private void FadeOut()
 {
     TimerStop.Start();
 }