Ejemplo n.º 1
0
 void Start()
 {
     timeToComplete       = TimeMinToComplete;
     actualState          = TriviaGameplayState.WAIT;
     uiManager            = FindObjectOfType <UiManager>().GetComponent <UiManager>();
     inputGameplayManager = FindObjectOfType <InputGameplayManager>().GetComponent <InputGameplayManager>();
 }
Ejemplo n.º 2
0
    public void ValidateAnswer(CorrectAnswer opt)
    {
        if (actualState != TriviaGameplayState.QUESTION)
        {
            return;
        }

        timeToCompleteCounter = 0;

        if (opt == correctAnswer)
        {
            cantQuestionsAnswered++;
            questionsAnswered.Add(randomQuestion);
            Checks[cantQuestionsAnswered - 1].sprite = OkIcon;
            SFXManager.SharedInstance.PlaySFX(SFXType.SoundType.CORRECT);

            if (Checks.Count == cantQuestionsAnswered)
            {
                actualState = TriviaGameplayState.END;
                uiManager.WinGame();
                GameManager.SharedInstance.ChangeGameManager(GameManager.GameState.GAME_OVER);
            }
            else
            {
                NewQuestion();
            }
        }
        else
        {
            FailAnswer();
        }
    }
Ejemplo n.º 3
0
    private void FailAnswer()
    {
        SFXManager.SharedInstance.PlaySFX(SFXType.SoundType.ERROR);
        actualState = TriviaGameplayState.WAIT;
        TriviaUI.SetActive(false);

        inputGameplayManager.StartGame();
    }
Ejemplo n.º 4
0
    IEnumerator StartingGame()
    {
        yield return(new WaitForSeconds(1f));

        TriviaUI.SetActive(true);
        NewQuestion();
        actualState = TriviaGameplayState.QUESTION;
        yield return(null);
    }