Exemplo n.º 1
0
        void UpdateQuestion(IQuestionPack questionPack)
        {
            hidePipesTimer      = 0;
            currentQuestionPack = questionPack;
            ResetLetters();

            questionLivingLetter = livingLetters[questionLetterIndex];
            ILivingLetterData correctAnswer = null;

            var correctAnswers = questionPack.GetCorrectAnswers();
            var correctList    = correctAnswers.ToList();

            correctAnswer = correctList[UnityEngine.Random.Range(0, correctList.Count)];

            if (ToboganConfiguration.Instance.Variation == ToboganVariation.SunMoon)
            {
                LL_WordData question = questionPack.GetQuestion() as LL_WordData;

                questionLivingLetter.SetQuestionText(question, 2, ToboganGame.LETTER_MARK_COLOR);
            }
            else
            {
                if (ToboganConfiguration.Instance.Difficulty <= 0.3f)
                {
                    questionLivingLetter.SetQuestionText(questionPack.GetQuestion() as LL_WordData, correctAnswer as LL_LetterData, ToboganGame.LETTER_MARK_COLOR);
                }
                else
                {
                    questionLivingLetter.SetQuestionText(questionPack.GetQuestion());
                }
            }

            var wrongAnswers = questionPack.GetWrongAnswers().ToList();

            // Shuffle wrong answers
            int n = wrongAnswers.Count;

            while (n > 1)
            {
                n--;
                int k     = UnityEngine.Random.Range(0, n + 1);
                var value = wrongAnswers[k];
                wrongAnswers[k] = wrongAnswers[n];
                wrongAnswers[n] = value;
            }

            game.pipesAnswerController.SetPipeAnswers(wrongAnswers, correctAnswer, sunMoonGameVariation);
        }