Exemple #1
0
        private void endgame()
        {
            timer.Stop();
            TimeSpan test = elapsedTimeDateTime;
            // DateTime ElapsedTime = DateTime.Parse(elapsedTime);
            int totalSeconds = (elapsedTimeDateTime.Hours * 360) + (elapsedTimeDateTime.Minutes * 60) + elapsedTimeDateTime.Seconds;

            if (totalSeconds < 20)
            {
                totalPoints = totalPoints + 100;
            }
            if (totalSeconds >= 20 && totalSeconds <= 40)
            {
                totalPoints = totalPoints + 50;
            }
            if (totalSeconds > 40)
            {
                totalPoints = totalPoints + 20;
            }
            double pointsForSteps = ((double)numberSteps) * 0.1;

            totalPoints = totalPoints - (int)pointsForSteps;
            if (totalPoints < 0)
            {
                totalPoints = 0;
            }

            typewriter.Stop();
            typewriter.SoundLocation = @"Music\mainMusic.wav";
            typewriter.PlayLooping();

            EndGame endGameWindow = new EndGame(totalPoints);

            endGameWindow.Tag = this.Tag;
            endGameWindow.Show();
            this.Close();
        }
Exemple #2
0
        private void endgame()
        {
            timer.Stop();
            TimeSpan test = elapsedTimeDateTime;
            // DateTime ElapsedTime = DateTime.Parse(elapsedTime);
            int totalSeconds = (elapsedTimeDateTime.Hours * 360) + (elapsedTimeDateTime.Minutes * 60) + elapsedTimeDateTime.Seconds;
            if (totalSeconds < 20)
                totalPoints = totalPoints + 100;
            if (totalSeconds >= 20 && totalSeconds <= 40)
                totalPoints = totalPoints + 50;
            if (totalSeconds > 40)
                totalPoints = totalPoints + 20;
            double pointsForSteps = ((double)numberSteps) * 0.1;

            totalPoints = totalPoints - (int)pointsForSteps;
            if (totalPoints < 0)
                totalPoints = 0;

            typewriter.Stop();
            typewriter.SoundLocation = @"Music\mainMusic.wav";
            typewriter.PlayLooping();

            EndGame endGameWindow = new EndGame(totalPoints);
            endGameWindow.Tag = this.Tag;
            endGameWindow.Show();
            this.Close();
        }