Beispiel #1
0
    /// <summary>
    /// calculates the parameters to update the question on display
    /// </summary>
    void UpdateQuestion()
    {
        // checks to see if the questions are over and if there are any incorrect questions
        // if true, enables the "incorrect loop"
        if (enemyUnit.incorrectlyAnsweredQs.Count > 1 &&
            questionNumber == enemyUnit.questions.Length)
        {
            incorrectLoop = true;
        }

        // checks if it should calculate the question on display
        // firstly checks if the question isn't at the end of the array of questions yet and if the bool incorrect loop is not enabled
        // or checks if the variable "incorrect loop" is true and if the length of the list of incorrect answers is greater than 1
        if (incorrectLoop && enemyUnit.incorrectlyAnsweredQs.Count > 1 || !incorrectLoop && questionNumber < enemyUnit.questions.Length)
        {
            clickyButton = true;

            //if its not the "incorrect loop", simply adds 1 to question counter
            //also ensures chance2 is disabled
            if (!incorrectLoop)
            {
                updateUI.DisplayChance2();
                questionNumber++;
            }
            else
            {
                //ensures chance 2 is enabled
                updateUI.DisplayChance2(true);
                //updates question on display
                questionNumber = enemyUnit.incorrectlyAnsweredQs[1];
            }

            //passes it onto the updateUI class with question number in toe
            updateUI.DisplayQuestion(questionNumber);
        }
        else
        {
            EndBattle();
        }
    }