Cleaning code a bit

For isAnsweringQuestion I simply flipped its boolean value like so:

isAnsweringQuestion = !isAnsweringQuestion

The exclamation basically flips/toggles the boolean value to opposite value.

Additionally, I used a ternary and used isAnsweringQuestion as the comparison:

void UpdateTimer()
    {
        timerValue -= Time.deltaTime;

        if (timerValue <= 0)
        {
            isAnsweringQuestion = !isAnsweringQuestion;

            timerValue = isAnsweringQuestion
                ? timeToCompleteQuestion
                : timeToShowCorrectAnswer;
        }

        Debug.Log(timerValue);
    }

Privacy & Terms