예제 #1
0
        public void Update()
        {
            if (!displayingNumbers)
            {
                return;
            }
            displayTimer += Time.deltaTime;
            if (displayTimer > stateMachine.GetGameBlueprint().timeBetweenNumbersDisplayed)
            {
                displayTimer = 0;
                //Play sound
                stateMachine.PlaySound(AudioFiles.GameplaySoundClip.DisplayInput);
                //display number on screen
                stateMachine.TriggerHUDEvent(UIEvents.Type.PrepareCombinationNumber, stateMachine.GetCombinationNumber().ToString());
                stateMachine.TriggerHUDEvent(UIEvents.Type.DisplayCombinationNumber, CombinationDisplay.Type.Normal.ToString());
                //spawn anim number
                stateMachine.TriggerHUDEvent(UIEvents.Type.SpawnAnimNumber, stateMachine.GetCombinationNumber().ToString());

                //if the current combination count is equal to the round
                if (stateMachine.GetCurrentCombinationCount() + 1 == stateMachine.GetRound())
                {
                    displayingNumbers = false;
                    stateMachine.StartCoroutine(FadeOutNumbers());
                }
                else
                {
                    stateMachine.IncrementCombinationCount();
                }
            }
        }
예제 #2
0
        public void Update()
        {
            if (!receivingInput)
            {
                return;
            }

            if (userInput.NumberPressed())
            {
                int number = userInput.GetNumberPressed();
                //Play Sounds
                stateMachine.PlaySound(AudioFiles.GameplaySoundClip.UserInput);
                //display number on screen
                stateMachine.TriggerHUDEvent(UIEvents.Type.PrepareCombinationNumber, number.ToString());
                stateMachine.TriggerHUDEvent(UIEvents.Type.DisplayCombinationNumber, CombinationDisplay.Type.Normal.ToString());

                //spawn anim number
                stateMachine.TriggerHUDEvent(UIEvents.Type.SpawnAnimNumber, number.ToString());

                //add to state controller user input
                stateMachine.AddToUserInput(number);
                //increment number count
                NumberCount++;
                if (stateMachine.GetRound() == NumberCount)
                {
                    receivingInput = false;

                    stateMachine.StartCoroutine(FadeOutNumbers());
                }
            }
        }
예제 #3
0
        public void Update()
        {
            if (!reviewing)
            {
                return;
            }
            reviewTimer += Time.deltaTime;
            if (reviewTimer > stateMachine.GetGameBlueprint().timeBetweenNumbersDisplayed)
            {
                reviewTimer = 0;

                bool correctInput = stateMachine.AreEqualByIndex(currentReviewIndex);

                stateMachine.TriggerHUDEvent(UIEvents.Type.PrepareCombinationNumber, stateMachine.GetUserInputNumber(currentReviewIndex).ToString());

                //spawn anim number
                stateMachine.TriggerHUDEvent(UIEvents.Type.SpawnAnimNumber, stateMachine.GetUserInputNumber(currentReviewIndex).ToString());


                //display combo number as incorrect or correct
                stateMachine.TriggerHUDEvent(UIEvents.Type.DisplayCombinationNumber, correctInput
                    ? CombinationDisplay.Type.Correct.ToString()
                    : CombinationDisplay.Type.InCorrect.ToString());
                //play correct or incorrect sound
                stateMachine.PlaySound(correctInput
                    ? AudioFiles.GameplaySoundClip.Correct
                    : AudioFiles.GameplaySoundClip.Incorrect);

                if (correctInput)
                {
                    pointsThisRound += stateMachine.GetGameBlueprint().pointsPerCorrectAnswer;
                }
                else
                {
                    perfectRound = false;
                    stateMachine.detectionLevel += stateMachine.GetGameBlueprint().incorrectPenalty;
                    stateMachine.TriggerHUDEvent(UIEvents.Type.UpdateDetectionSlider, stateMachine.detectionLevel.ToString());
                }

                //Review Complete
                if (currentReviewIndex == stateMachine.GetRound() - 1)
                {
                    reviewing = false;
                    DetermineNextSteps();
                }
                currentReviewIndex++;
            }
        }
예제 #4
0
 /// <summary>
 /// when the replay game button is selected
 /// </summary>
 /// <param name="message"></param>
 private void ReplayGame(string message)
 {
     stateMachine.PlaySound(AudioFiles.UISoundClip.CartoonPop);
     stateMachine.ChangeState(GameplayStateMachine.GameplayState.Replay);
 }