private void GameLoop(object sender, ElapsedEventArgs e)
        {
            this.Dispatcher.Invoke(() =>
            {
                if (!gameOver && countDown < 0)
                {
                    MoveDown();
                    CalculateInterval();
                }
                else if (countDown >= 0)
                {
                    countDown--;

                    if (countDown == -1)
                    {
                        myEvents.getAggregator().PublishOnUIThread(new TickDownEvent(countDown));
                        StartGame();
                        encoderTimer.Start();
                    }
                    else
                    {
                        if (countDown == 0)
                        {
                            audioManager.PlaySound(Sound.TIMER_END);
                        }
                        else
                        {
                            audioManager.PlaySound(Sound.TIMER);
                        }
                        myEvents.getAggregator().PublishOnUIThread(new TickDownEvent(countDown));
                    }
                }
            });
        }
Esempio n. 2
0
 /// <summary>Plays intro sound on the UI thread.</summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="ElapsedEventArgs" /> instance containing the event data.</param>
 private void Intro(object sender, ElapsedEventArgs e)
 {
     this.OnUIThread(() =>
     {
         audioManager.PlaySound(Sound.INTRO);
         eventTimer.Stop();
         eventTimer.Dispose();
     });
 }
Esempio n. 3
0
 private void EffectsBlip(object sender, DragCompletedEventArgs e)
 {
     audioManager.PlaySound(Sound.TIMER_END);
 }