Beispiel #1
0
 private void correctChoice(Vector2 pos)
 {
     particleEffect.Trigger(pos);
     questionIsCorrect = true;
     destroyGameSet();
     correct_snd.MultiPlay();
     score++;
     textAnimator.Start();
 }
Beispiel #2
0
 private void correctChoice(Vector2 pos)
 {
     particleEffect.Trigger(pos); //To-do:Kenny particleEffect.Trigger position to be at where the object is instead of collision
     questionIsCorrect = true;
     destroyGameSet();
     //generateGameSet(); //remove this line once destroyGameSet() is implemented.
     correct_snd.MultiPlay();
     this.score++;
     textAnimator.Start();
 }
Beispiel #3
0
        /// <summary>
        /// This function triggers whenever a correct choice has been made by the user
        /// </summary>
        /// <param name="pos">Position of correct solution</param>

        private void correctChoice(Vector2 pos)
        {
            questionIsCorrect = true;
            //Particle Effect
            particleEffect.Trigger(pos);
            //Change GameSet
            destroyGameSet();
            //Play sound
            correct_snd.MultiPlay();
            // Add Score
            GameScoringSystem.Instance.addScore(gameTimeManager.GameTime.ElapsedGameTime.Milliseconds);
            GameScoringSystem.Instance.checkWinningCondition(ref this.gameLevelManager, ref content);

            // Display Encouragements
            textAnim_GoodJob.Start();
        }
Beispiel #4
0
        /// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, false);

            // Gradually fade in or out depending on whether we are covered by the pause screen.
            if (coveredByOtherScreen)
            {
                pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1);
            }
            else
            {
                pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0);
            }

            if (IsActive) // indicates whether this screen is front most, ie: active
            {
                //Duplicate and store game time to allow other functions to acccess the game time var.
                gameTimeManager.GameTime = gameTime;

                // Question related variables initialization
                float SecondsPassed = (float)gameTime.ElapsedGameTime.TotalSeconds;
                particleEffect.Update(SecondsPassed);

                // Update Interactive elements.
                textAnim_GameOver.updateTweener(gameTime);
                textAnim_GoodJob.updateTweener(gameTime);


                if (gameTimeManager.intervalPerQuestionUp(gameTime))
                {
                    generateGameSet();
                    gameTimeManager.restartQuestionTimeCounter();
                }

                // Check whether Question is correct first before processing gameTimeManager
                if (questionIsCorrect && gameTimeManager.intervalBtwQuestionUp(gameTime))
                {
                    textAnim_GoodJob.Stop();
                    generateGameSet();
                    gameTimeManager.restartQuestionTimeCounter();
                }


                // Each Game has only a fixed time
                if (gameTimeManager.intervalPerGameRoundUp(gameTime))
                {
                    textAnim_GameOver.Start();

                    if (gameTimeManager.pause(gameTime, 6)) // pause to display textAnim to allow user to read.
                    {
                        textAnim_GameOver.Stop();

                        // For now we would indicate that the game is up by simply going back to the main menu.
                        LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                                           new MainMenuScreen());

                        // Explicitly Reset score, due to singleton property.
                        GameScoringSystem.Instance.resetScore();
                    }
                }
            }
        }