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(); } } }
public void Begin() { //init generate combination stateMachine.GenerateCombination(); //UI stateMachine.TriggerHUDEvent(UIEvents.Type.InitProgressWidget, stateMachine.GetGameBlueprint().combinationCount.ToString()); //GO TO INTRO STATE stateMachine.ChangeState(GameplayStateMachine.GameplayState.Intro); }
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++; } }