Exemplo n.º 1
0
        void gameOver(Session session)
        {
            _watcher.Stop();

            // Save session to database
            App.ViewModel.AddSession(new Models.SessionModel(session));

            // Show game duration in a message box
            TimeSpan duration = session.Duration;
            String durationString = "You lasted ";
            if (duration.Hours >= 1.0)
            {
                durationString += (int)duration.Hours + " h " + (int)duration.Minutes + " min ";
            }
            else if (duration.Minutes >= 1.0)
            {
                durationString += (int)duration.Minutes + " min ";
            }
            durationString += (int)duration.Seconds + " s.";
            MessageBox.Show("Game over! " + durationString);
            NavigationService.GoBack();
        }
Exemplo n.º 2
0
        public void Start()
        {
            if (_gameTimer.IsEnabled)
            {
                // Game is already running
                return;
            }

            Ghosts.Clear();

            Session = new Session();
            Session.Difficulty = Difficulty;
            Session.Start();

            _gameTimer.Start();

            if (gameStarted != null)
            {
                gameStarted();
            }
        }