예제 #1
0
        public void EnterState()
        {
            Finished = false;
            game.antura.AllowSitting = false;
            game.isTimesUp           = false;
            gameTime.Reset(game.TimeToAnswer);
            if (!TutorialMode)
            {
                countdownCo = game.StartCoroutine(CountdownSFXCO());
            }

            game.circleBox.SetActive(true);
            box = game.circleBox.GetComponent <CircleButtonBox>();
            box.Clear();

            correctLLData = game.CurrentQuestion.GetCorrectAnswers().First();
            var wrongs = game.CurrentQuestion.GetWrongAnswers();

            var choices = new List <ILivingLetterData>();

            // Difficulty for game type ReadAndListen
            int maxWrongs = Mathf.RoundToInt(2 + 3 * game.Difficulty);

            choices.AddRange(wrongs);
            for (int i = maxWrongs, count = choices.Count; i < count; ++i)
            {
                choices.RemoveAt(choices.Count - 1);
            }

            choices.Add(correctLLData);
            choices.Shuffle();

            float delay = 0;

            foreach (var c in choices)
            {
                var imageData = new LL_ImageData(c.Id);
                var button    = box.AddButton(imageData, OnAnswered, delay);
                delay += 0.2f;

                if (c == correctLLData)
                {
                    correctButton = button;
                }
            }

            box.Active = true;

            if (!TutorialMode)
            {
                if (showOldTimer)
                {
                    game.radialWidget.Show();
                    game.radialWidget.Reset(ReadTime / MaxTime);
                    game.radialWidget.inFront = true;
                    game.radialWidget.pulsing = true;
                }

                gameTime.Start();
            }

            if (ReadingGameConfiguration.Instance.CurrentGameType == ReadingGameConfiguration.GameType.ReadAndListen)
            {
                game.EnableRepeatPromptButton();
            }
        }