Example #1
0
    private IEnumerator displayQuestionWithDelay(int pQuestionIndex)
    {
        yield return(new WaitUntil(() => FindObjectOfType <QuestionDisplay>() != null));

        QuestionDisplay qd = FindObjectOfType <QuestionDisplay>();

        if (qd != null)
        {
            qd.DisplayQuestion(pQuestionIndex);
        }
    }
    //internal static void GetTriviaQuestion(Tile currentTile)
    //{
    //    var color = currentTile.color;
    //    Category category = (Category)Enum.Parse(typeof(Category), color, true);

    //    Question newQuestion = _qdb.GetQuestion(Category.RED).Prompt;
    //}

    public void GetAndDisplayNewTriviaQuestion(string color)
    {
        Debug.Log($"RuleController asks QuestionDB to display trivia question and answer choices.");
        var questionDisplay = new QuestionDisplay();

        _currentQuestion = questionDisplay.GetNewQuestion(color, _qdb);

        //activate the group first or the DisplayQuestion method wont be able to find the GameObjects
        SetAndActivateTimer();
        ActivateQuestionAnswerGroup(true);

        questionDisplay.DisplayQuestion(_currentQuestion);
    }