예제 #1
0
        public IEnumerator AnimateLettersCO(float periodRatio, bool tutorialMode)
        {
            for (var iLetter = 0; iLetter < animDatas.Length; iLetter++)
            {
                var animData = animDatas[iLetter];
                var llData   = new LL_ImageData(animData.dataID);
                var gameLL   = new GameLivingLetter(transform.parent, letterObjectViewPrefab, shadowPrefab,
                                                    llData,
                                                    animData.startPosTr.position - Vector3.up * animData.jumpHeight, transform.localPosition,
                                                    animData.startPosTr.position, animData.timing * periodRatio, null, animData.scale,
                                                    danceSpeedMultiplier);
                gameLetters.Add(gameLL);
                StartCoroutine(WaitThenAnimateCO(animData, gameLL, periodRatio));
            }

            if (!tutorialMode)
            {
                mayDrop = true;
                yield return(new WaitForSeconds(waitBeforeStill * periodRatio));

                for (var iLetter = 0; iLetter < animDatas.Length; iLetter++)
                {
                    var animData = animDatas[iLetter];
                    var gameLL   = gameLetters[iLetter];
                    gameLL.livingLetter.SetState(LLAnimationStates.LL_still);
                    StartCoroutine(WaitThenDropCO(animData, gameLL, periodRatio));
                }
            }
        }
        IQuestionPack IQuestionProvider.GetNextQuestion()
        {
            questionsDone++;

            if (questionsDone == 1)
            {
                return(sunQuestion);
            }
            else if (questionsDone == 2)
            {
                return(moonQuestion);
            }
            else
            {
                var data = provider.GetNextQuestion();

                var correct = data.GetCorrectAnswers();
                var wrong   = data.GetWrongAnswers();

                var correctImages = correct.ToArray();
                var wrongImages   = wrong.ToArray();

                for (int i = 0; i < correctImages.Length; ++i)
                {
                    correctImages[i] = new LL_ImageData(correctImages[i].Id);
                }

                for (int i = 0; i < wrongImages.Length; ++i)
                {
                    wrongImages[i] = new LL_ImageData(wrongImages[i].Id);
                }

                return(new SampleQuestionPack(data.GetQuestion(), wrongImages, correctImages));
            }
        }
예제 #3
0
        private IQuestion GenerateMissingLetterQuestion(ILivingLetterData data, ILivingLetterData letterToRemove)
        {
            var           imageData = new LL_ImageData(data.Id);
            LL_WordData   word      = (LL_WordData)data;
            LL_LetterData letter    = (LL_LetterData)letterToRemove;

            cacheCompleteWord = word.TextForLivingLetter;

            var partsToRemove = LanguageSwitcher.I.GetHelper(LanguageUse.Learning).FindLetter(AppManager.I.DB, word.Data, letter.Data, LetterEqualityStrictness.Letter);

            partsToRemove.Shuffle(); //pick a random letter

            string text = LanguageSwitcher.I.GetHelper(LanguageUse.Learning).GetWordWithMissingLetterText(
                word.Data, partsToRemove[0], removedLetterColor: "#000000");

            //Spawn word, then replace text with text with missing letter
            var wordGO = ItemFactory.Instance.SpawnQuestion(word);

            wordGO.InstaShrink();

            wordGO.Label.text   = text;
            cacheCompleteWordLL = wordGO;

            wordGO.SetExtendedBoxCollider();

            return(new ImageQuestion(wordGO, imageData, audioManager));
        }
예제 #4
0
        void ShowEndLetters()
        {
            EggLivingLetter letter;
            float           startDelay = 0f;
            float           jumpDelay  = 0.5f;

            Vector3[] lettersEndPositions = GetLettersEndPositions();

            Vector3 lLetterPosition = new Vector3(transform.localPosition.x, egg.transform.localPosition.y, transform.localPosition.z);

            for (int i = 0; i < answersData.Count; i++)
            {
                letter = new EggLivingLetter(transform.parent, letterObjectViewPrefab, shadowPrefab, answersData[i], lLetterPosition, transform.localPosition, lettersEndPositions[i], (jumpDelay * i) + startDelay, null);

                eggLivingLetters.Add(letter);
            }

            if (questionData != null)
            {
                Vector3 finalLivingLetterEndPosition = new Vector3(0, -1f, -17);
                var     questionImageData            = new LL_ImageData(questionData.Id);
                var     finalLivingLetter            = new EggLivingLetter(transform.parent, letterObjectViewPrefab, shadowPrefab,
                                                                           questionImageData, lLetterPosition, transform.localPosition, finalLivingLetterEndPosition, (jumpDelay * answersData.Count) + startDelay, null);

                eggLivingLetters.Add(finalLivingLetter);
            }
        }
예제 #5
0
        void SetupTutorial()
        {
            currentQuestion = HideAndSeekConfiguration.Instance.Questions.GetNextQuestion();
            List <ILivingLetterData> letterList = new List <ILivingLetterData>();

            ILivingLetterData right = currentQuestion.GetCorrectAnswers().ToList()[0];
            ILivingLetterData wrong = currentQuestion.GetWrongAnswers().ToList()[0];

            if (HideAndSeekConfiguration.Instance.Variation == HideAndSeekVariation.Image)
            {
                right = new LL_ImageData(right.Id);
                wrong = new LL_ImageData(wrong.Id);
            }

            letterList.Add(right);
            letterList.Add(wrong);

            // Set the wrong answer
            ArrayLetters[0].transform.position = ArrayPlaceholder[0].transform.position;
            ArrayLetters[0].GetComponent <HideAndSeekLetterController>().id = 3;

            ArrayLetters[0].GetComponentInChildren <LivingLetterController>().Init(wrong);
            ArrayTrees[0].GetComponent <SphereCollider>().enabled    = true;
            ArrayLetters[0].GetComponent <CapsuleCollider>().enabled = false;


            // Set the correct answer
            ArrayLetters[1].transform.position = ArrayPlaceholder[1].transform.position;
            ArrayLetters[1].GetComponent <HideAndSeekLetterController>().id = 5;

            ArrayLetters[1].GetComponentInChildren <LivingLetterController>().Init(right);

            StartCoroutine(WaitTutorial());
        }
        private IQuestion GenerateQuestion(ILivingLetterData data)
        {
            if (AssessmentConfiguration.Instance.ShowQuestionAsImage)
            {
                data = new LL_ImageData(data.Id);
            }

            var q = LivingLetterFactory.Instance.SpawnQuestion(data);

            return(new DefaultQuestion(q, 0));
        }
예제 #7
0
        private IQuestion GenerateQuestion(ILivingLetterData data)
        {
            cacheFullWordData = new LL_WordData(data.Id);

            if (AssessmentOptions.Instance.ShowQuestionAsImage)
            {
                data = new LL_ImageData(data.Id);
            }

            cacheFullWordDataLL = ItemFactory.Instance.SpawnQuestion(data);
            return(new DefaultQuestion(cacheFullWordDataLL, 0, audioManager));
        }
        public SunMoonTutorialQuestionProvider(IQuestionProvider provider)
        {
            this.provider = provider;

            var db       = AppManager.I.DB;
            var sunWord  = db.GetWordDataById("the_sun");
            var sunData  = new LL_ImageData(sunWord.Id, sunWord);
            var moonWord = db.GetWordDataById("the_moon");
            var moonData = new LL_ImageData(moonWord.Id, moonWord);

            sunQuestion  = new SampleQuestionPack(new LL_WordData(sunWord.Id, sunWord), new ILivingLetterData[] { moonData }, new ILivingLetterData[] { sunData });
            moonQuestion = new SampleQuestionPack(new LL_WordData(moonWord.Id, moonWord), new ILivingLetterData[] { sunData }, new ILivingLetterData[] { moonData });
        }
예제 #9
0
        public void StartQuestion(List <ILivingLetterData> nextChallenge, List <ILivingLetterData> wrongAnswers)
        {
            Clean();

            for (int i = 0; i < nextChallenge.Count; ++i)
            {
                var correctAnswer = nextChallenge[i];

                // Add drop areas
                if (FastCrowdConfiguration.Instance.Variation == FastCrowdVariation.Counting)
                {
                    dropContainer.AddDropData(correctAnswer, true);
                }
                else if (FastCrowdConfiguration.Instance.Variation == FastCrowdVariation.Word ||
                         FastCrowdConfiguration.Instance.Variation == FastCrowdVariation.Image ||
                         FastCrowdConfiguration.Instance.Variation == FastCrowdVariation.CategoryForm ||
                         FastCrowdConfiguration.Instance.IsOrderingVariation)
                {
                    dropContainer.AddDropData(correctAnswer, true);
                }
                else
                {
                    dropContainer.AddDropData(correctAnswer, false);
                }

                // Add living letters
                if (FastCrowdConfiguration.Instance.Variation == FastCrowdVariation.Image ||
                    FastCrowdConfiguration.Instance.Variation == FastCrowdVariation.CategoryForm ||
                    FastCrowdConfiguration.Instance.IsOrderingVariation
                    )
                {
                    correctAnswer = new LL_ImageData(correctAnswer.Id);
                }

                crowd.AddLivingLetter(correctAnswer);
            }

            foreach (var wrongAnswer in wrongAnswers)
            {
                var answer = wrongAnswer;
                if (FastCrowdConfiguration.Instance.Variation == FastCrowdVariation.Image ||
                    FastCrowdConfiguration.Instance.Variation == FastCrowdVariation.CategoryForm ||
                    FastCrowdConfiguration.Instance.IsOrderingVariation)
                {
                    answer = new LL_ImageData(answer.Id);
                }

                // Add living letters
                crowd.AddLivingLetter(answer);
            }
        }
예제 #10
0
        public void Init(ILivingLetterData _data, DropContainer _dropContainer, bool asImage)
        {
            Data = _data;

            if (asImage)
            {
                _data = new LL_ImageData(_data.Id);
            }

            LetterText.SetLetterData(_data);
            LetterText.gameObject.SetActive(true);

            AreaState = State.disabled;
        }
예제 #11
0
        private IQuestion GenerateQuestion(ILivingLetterData data, int correctCount)
        {
            cacheQuestionToRead = data;
            if (AssessmentOptions.Instance.ShowQuestionAsImage)
            {
                data = new LL_ImageData(data.Id);
            }
            var q = ItemFactory.Instance.SpawnQuestion(data);

            if (AssessmentOptions.Instance.QuestionAnsweredFlip)
            {
                q.GetComponent <StillLetterBox>().HideHiddenQuestion();
            }
            return(new DefaultQuestion(q, correctCount, dialogues));
        }
예제 #12
0
        public Answer SpawnAnswer(ILivingLetterData data, bool correct, AssessmentAudioManager dialogues)
        {
            if (AssessmentOptions.Instance.ShowAnswersAsImages)
            {
                data = new LL_ImageData(data.Id);
            }

            // Organize LLs in inspector's hierarchy view
            var letter = SpawnStillLetter(Answers);

            // Link LL to answer
            var answ = letter.gameObject.AddComponent <Answer>();

            letter.Init(data, true);
            answ.Init(correct, dialogues, data);
            return(answ);
        }
예제 #13
0
        public SunMoonQuestionProvider()
        {
            currentQuestion = -1;

            // 10 QuestionPacks
            for (int i = 0; i < 32; i++)
            {
                List <ILivingLetterData> correctAnswers = new List <ILivingLetterData>();
                List <ILivingLetterData> wrongAnswers   = new List <ILivingLetterData>();

                var data = AppManager.I.Teacher.GetRandomTestLetterLL();

                if (data == null)
                {
                    return;
                }

                // sun
                var sunData  = AppManager.I.DB.GetWordDataById("the_sun");
                var moonData = AppManager.I.DB.GetWordDataById("the_moon");

                ILivingLetterData sunWord  = new LL_ImageData(sunData.GetId(), sunData);
                ILivingLetterData moonWord = new LL_ImageData(moonData.GetId(), moonData);

                if (data.Data.SunMoon == Database.LetterDataSunMoon.Sun)
                {
                    correctAnswers.Add(sunWord);
                    wrongAnswers.Add(moonWord);
                }
                else if (data.Data.SunMoon == Database.LetterDataSunMoon.Moon)
                {
                    correctAnswers.Add(moonWord);
                    wrongAnswers.Add(sunWord);
                }
                else
                {
                    continue;
                }

                var currentPack = new SampleQuestionPack(data, wrongAnswers, correctAnswers);
                questions.Add(currentPack);
            }
        }
예제 #14
0
        void SetAndShowEggButtons()
        {
            List <ILivingLetterData> lLetterDataSequence = game.CurrentQuestion.Answers;

            for (int i = 0; i < lLetterDataSequence.Count; i++)
            {
                var data = lLetterDataSequence[i];
                if (EggConfiguration.Instance.Variation == EggVariation.Image)
                {
                    data = new LL_ImageData(data.Id);
                }

                game.eggButtonBox.AddButton(data);
            }

            game.eggButtonBox.SetButtonsOnPosition();
            game.eggButtonBox.ShowButtons();
            game.eggButtonBox.SetOnPressedCallback(OnEggButtonPressed);

            game.eggController.EmoticonInterrogative();

            game.StartCoroutine(ShowQuestionSequence());
        }
예제 #15
0
        public void SetWord(string imageId, LL_WordData wordData)
        {
            if (wordData == null)
            {
                WordTextGO.SetActive(false);
            }
            else
            {
                WordTextGO.SetActive(true);
                WordTextGO.GetComponent <TextRender>().SetLetterData(wordData);
            }

            if (!imageId.IsNullOrEmpty())
            {
                var imageData = new LL_ImageData(wordData.Id);
                DrawingImageGO.SetActive(true);
                DrawingImageGO.GetComponent <TextRender>().SetLetterData(imageData);
            }
            else
            {
                DrawingImageGO.SetActive(false);
            }
        }
        private IQuestion GenerateMissingLetterQuestion(ILivingLetterData data, ILivingLetterData letterToRemove)
        {
            var           imageData = new LL_ImageData(data.Id);
            LL_WordData   word      = (LL_WordData)data;
            LL_LetterData letter    = (LL_LetterData)letterToRemove;
            var           Letters   = ArabicAlphabetHelper.ExtractLetterDataFromArabicWord(word.Data.Arabic);

            int index = 0;

            for (; index < Letters.Count; ++index)
            {
                if (Letters[index].Id == letter.Id)
                {
                    break;
                }
            }

            var wordGO = LivingLetterFactory.Instance.SpawnQuestion(word);

            wordGO.Label.text = wordGO.Label.text.Remove(index, 1);
            wordGO.Label.text = wordGO.Label.text.Insert(index, RemovedLetterChar);

            return(new ImageQuestion(wordGO, imageData));
        }
예제 #17
0
        private IEnumerator ShowWinSequence(LetterController correctLetterCntrl)
        {
            correctLetterCntrl.ShowVictoryRays();

            yield return(new WaitForSeconds(0.33f));

            correctLetterCntrl.Vanish();
            correctLetterCntrl.Reset();

            yield return(new WaitForSeconds(0.7f));

            SayQuestion();

            correctLetterCntrl.SetMotionVariation(LetterController.MotionVariation.Idle);
            correctLetterCntrl.SetPropVariation(LetterController.PropVariation.Nothing);
            correctLetterCntrl.MoveTo(0, 13.5f, -33f);
            correctLetterCntrl.transform.rotation = Quaternion.Euler(-Camera.main.transform.rotation.eulerAngles.x, 180, 0);
            correctLetterCntrl.shadow.SetActive(false);

            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.BuildWord)
            {
                var imageQuestion = new LL_ImageData(question.Id);
                correctLetterCntrl.SetData(imageQuestion);
            }

            correctLetterCntrl.Show();
            correctLetterCntrl.letterObjectView.DoHorray();

            game.Context.GetAudioManager().PlaySound(Sfx.Win);

            yield return(new WaitForSeconds(3f));

            correctLetterCntrl.HideVictoryRays();

            OnRoundConcluded();
        }
예제 #18
0
        public IEnumerator StartNewRound_Single()
        {
            ResetScene();

            if (!uiInitialised && !IsTutorialRound())
            {
                uiInitialised = true;

                game.Context.GetOverlayWidget().Initialize(true, false, true);
                game.Context.GetOverlayWidget().SetStarsThresholds(1, 3, 5);
                game.Context.GetOverlayWidget().SetMaxLives(MAX_NUM_BALLS);
            }

            IQuestionPack newQuestionPack = ThrowBallsConfiguration.Instance.Questions.GetNextQuestion();

            question = newQuestionPack.GetQuestion();
            ILivingLetterData        correctDatum = newQuestionPack.GetCorrectAnswers().ToList()[0];
            List <ILivingLetterData> wrongData    = newQuestionPack.GetWrongAnswers().ToList();

            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.Word ||
                ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.Image)
            {
                correctDatum = new LL_ImageData(correctDatum.Id);

                for (int i = 0; i < wrongData.Count; i++)
                {
                    wrongData[i] = new LL_ImageData(wrongData[i].Id);
                }

                if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.Image)
                {
                    question = new LL_ImageData(question.Id);
                }
            }

            SayQuestion();

            yield return(new WaitForSeconds(1f));

            int indexOfCorrectLetter = 0;

            if (game.Difficulty <= MiniGameController.EASY || IsTutorialRound())
            {
                for (int i = 0; i < NumLettersInCurrentRound; i++)
                {
                    letterPool[i].SetActive(true);
                }

                int indexOfUnobstructedLetter = 0;

                while (letterControllers[indexOfUnobstructedLetter].IsObstructedByOtherLetter())
                {
                    indexOfUnobstructedLetter++;
                }

                indexOfCorrectLetter = indexOfUnobstructedLetter;
            }

            var prevIndices = ExtractPrevIndices();

            for (int i = 0; i < NumLettersInCurrentRound; i++)
            {
                GameObject letterObj = letterPool[i];

                letterObj.SetActive(true);

                ConfigureLetterPropAndMotionVariation(letterControllers[i], prevIndices.Contains(i) ? prevMode : nextMode);

                if (i == indexOfCorrectLetter)
                {
                    letterObj.tag = Constants.CORRECT_LETTER_TAG;
                    letterControllers[i].SetData(correctDatum);
                    tutorialTarget = letterObj;
                }
                else
                {
                    letterObj.tag = Constants.WRONG_LETTER_TAG;
                    letterControllers[i].SetData(wrongData[0]);
                    wrongData.RemoveAt(0);
                }
            }

            isRoundOngoing = true;

            BallController.instance.Enable();

            UIController.instance.Enable();
            UIController.instance.EnableLetterHint();
            UIController.instance.SetLivingLetterData(question);

            if (IsTutorialRound())
            {
                audioManager.PlayDialogue(ThrowBallsConfiguration.Instance.TutorialLocalizationId);
                inputManager.Enabled = true;
                isVoiceOverDone      = true;
                ShowTutorialUI();
            }
        }
예제 #19
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();
            }
        }
예제 #20
0
        public IEnumerator StartNewRound()
        {
            ResetScene();

            if (roundNumber == 1)
            {
                MinigamesUI.Init(MinigamesUIElement.Lives | MinigamesUIElement.Starbar);
                MinigamesUI.Lives.Setup(MAX_NUM_BALLS);
            }

            IQuestionPack newQuestionPack = ThrowBallsConfiguration.Instance.Questions.GetNextQuestion();

            question = newQuestionPack.GetQuestion();
            ILivingLetterData        correctDatum = newQuestionPack.GetCorrectAnswers().ToList()[0];
            List <ILivingLetterData> wrongData    = newQuestionPack.GetWrongAnswers().ToList();

            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.words)
            {
                correctDatum = new LL_ImageData(correctDatum.Id);

                for (int i = 0; i < wrongData.Count; i++)
                {
                    wrongData[i] = new LL_ImageData(wrongData[i].Id);
                }
            }

            SayQuestion();

            yield return(new WaitForSeconds(1f));

            for (int i = 0; i < numLetters; i++)
            {
                GameObject letterObj = letterPool[i];

                letterObj.SetActive(true);

                letterControllers[i].SetMotionVariation(GetMotionOfRound());

                letterControllers[i].SetPropVariation(GetPropOfRound());

                if (i == 0)
                {
                    letterObj.tag = Constants.TAG_CORRECT_LETTER;
                    letterControllers[i].SetLetter(correctDatum);
                }

                else
                {
                    letterObj.tag = Constants.TAG_WRONG_LETTER;

                    letterControllers[i].SetLetter(wrongData[0]);

                    wrongData.RemoveAt(0);
                }
            }

            isRoundOngoing = true;

            BallController.instance.Enable();

            UIController.instance.Enable();
            UIController.instance.SetLetterHint(question);

            if (IsTutorialLevel())
            {
                switch (ThrowBallsConfiguration.Instance.Variation)
                {
                case ThrowBallsVariation.letters:
                    audioManager.PlayDialogue(Db.LocalizationDataId.ThrowBalls_letters_Tuto);
                    break;

                case ThrowBallsVariation.words:
                    audioManager.PlayDialogue(Db.LocalizationDataId.ThrowBalls_words_Tuto);
                    break;

                case ThrowBallsVariation.lettersinword:
                    audioManager.PlayDialogue(Db.LocalizationDataId.ThrowBalls_letterinword_Tuto);
                    break;

                default:
                    break;
                }

                inputManager.Enabled = true;
                isVoiceOverDone      = true;
                ShowTutorialUI();
            }
        }
예제 #21
0
        public void Update(float delta)
        {
            if (toNextState)
            {
                nextStateTimer -= delta;

                if (nextStateTimer <= 0f)
                {
                    toNextState = false;

                    if (!showTutorial)
                    {
                        if (game.stagePositiveResult)
                        {
                            game.CurrentScore++;

                            ILivingLetterData runLetterData;

                            if (EggConfiguration.Instance.Variation == EggVariation.BuildWord)
                            {
                                runLetterData = new LL_ImageData(game.CurrentQuestion.Question.Id);
                            }
                            else if (EggConfiguration.Instance.Variation == EggVariation.Image)
                            {
                                runLetterData = new LL_ImageData(game.CurrentQuestion.Answers[0].Id);
                            }
                            else
                            {
                                runLetterData = game.CurrentQuestion.Answers[0];
                            }

                            game.runLettersBox.AddRunLetter(runLetterData);
                        }

                        game.currentStage++;
                        game.antura.NextStage();
                    }

                    game.SetCurrentState(game.ResultState);
                }
            }

            inputButtonTimer -= delta;

            if (repeatInputHasProgressed)
            {
                PlayPositiveAudioFeedback();

                game.eggController.EmoticonPositive();
                game.eggController.StartShake();
                game.eggController.ParticleCorrectEnabled();

                repeatInputHasProgressed = false;
                if (inputButtonTimer >= 0)
                {
                    inputButtonCount++;
                }
                else
                {
                    inputButtonCount = 0;
                }

                if (inputButtonCount >= inputButtonMax)
                {
                    inputButtonCount = 0;
                    PositiveFeedback();
                }

                tutorialDelayTimer = 0.5f;

                inputButtonTimer = inputButtonTime;
            }

            if (showTutorial && !tutorialStop)
            {
                if (tutorialCorrectActive)
                {
                    tutorialCorrectTimer -= delta;
                    if (tutorialCorrectTimer <= 0f)
                    {
                        if (isSequence)
                        {
                            tutorialSequenceIndex++;
                            if (tutorialSequenceIndex < correctAnswers)
                            {
                                tutorialCorrectTimer = 1f;

                                Vector3 clickPosition = game.eggButtonBox.GetButtons(false)[tutorialSequenceIndex].transform.position;
                                TutorialUI.Click(clickPosition);
                            }
                            else
                            {
                                tutorialCorrectActive = false;
                                tutorialDelayTimer    = tutorialDelayTime;
                            }
                        }
                        else
                        {
                            tutorialCorrectActive = false;
                            tutorialDelayTimer    = tutorialDelayTime;
                        }
                    }
                }
                else
                {
                    tutorialDelayTimer -= delta;

                    if (tutorialDelayTimer <= 0f)
                    {
                        ShowTutorialPressCorrect();
                    }
                }
            }
        }
예제 #22
0
        public IEnumerator StartNewRound()
        {
            ResetScene();

            if (!uiInitialised && !IsTutorialRound())
            {
                uiInitialised = true;


                game.Context.GetOverlayWidget().Initialize(true, false, true);
                game.Context.GetOverlayWidget().SetStarsThresholds(1, 3, 5);
                game.Context.GetOverlayWidget().SetMaxLives(MAX_NUM_BALLS);
            }

            IQuestionPack newQuestionPack = ThrowBallsConfiguration.Instance.Questions.GetNextQuestion();

            question = newQuestionPack.GetQuestion();

            ILivingLetterData        correctDatum = newQuestionPack.GetCorrectAnswers().ToList()[0];
            List <ILivingLetterData> wrongData    = newQuestionPack.GetWrongAnswers().ToList();

            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.Word)
            {
                correctDatum = new LL_ImageData(correctDatum.Id);

                for (int i = 0; i < wrongData.Count; i++)
                {
                    wrongData[i] = new LL_ImageData(wrongData[i].Id);
                }
            }

            SayQuestion();

            yield return(new WaitForSeconds(1f));

            int indexOfCorrectLetter = 0;

            if (game.Difficulty <= ThrowBallsGame.ThrowBallsDifficulty.Easy || IsTutorialRound())
            {
                for (int i = 0; i < NumLettersInCurrentRound; i++)
                {
                    letterPool[i].SetActive(true);
                }

                int indexOfUnobstructedLetter = 0;

                while (letterControllers[indexOfUnobstructedLetter].IsObstructedByOtherLetter())
                {
                    indexOfUnobstructedLetter++;
                }

                indexOfCorrectLetter = indexOfUnobstructedLetter;
            }

            for (int i = 0; i < NumLettersInCurrentRound; i++)
            {
                GameObject letterObj = letterPool[i];

                letterObj.SetActive(true);

                ConfigureLetterPropAndMotionVariation(letterControllers[i]);

                if (i == indexOfCorrectLetter)
                {
                    letterObj.tag = Constants.CORRECT_LETTER_TAG;
                    letterControllers[i].SetLetter(correctDatum);
                    tutorialTarget = letterObj;
                }
                else
                {
                    letterObj.tag = Constants.WRONG_LETTER_TAG;
                    letterControllers[i].SetLetter(wrongData[0]);
                    wrongData.RemoveAt(0);
                }
            }

            isRoundOngoing = true;

            BallController.instance.Enable();

            UIController.instance.Enable();
            UIController.instance.EnableLetterHint();
            UIController.instance.SetLivingLetterData(question);

            if (IsTutorialRound())
            {
                switch (ThrowBallsConfiguration.Instance.Variation)
                {
                case ThrowBallsVariation.LetterName:
                    audioManager.PlayDialogue(Database.LocalizationDataId.ThrowBalls_lettername_Tuto);
                    break;

                case ThrowBallsVariation.LetterAny:
                    audioManager.PlayDialogue(Database.LocalizationDataId.ThrowBalls_lettername_Tuto);
                    break;

                case ThrowBallsVariation.Word:
                    audioManager.PlayDialogue(Database.LocalizationDataId.ThrowBalls_word_Tuto);
                    break;

                case ThrowBallsVariation.BuildWord:
                    audioManager.PlayDialogue(Database.LocalizationDataId.ThrowBalls_buildword_Tuto);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                inputManager.Enabled = true;
                isVoiceOverDone      = true;
                ShowTutorialUI();
            }
        }
예제 #23
0
        public void NewRound()
        {
            ClearRound();

            isRoundRunning  = true;
            currentQuestion = HideAndSeekConfiguration.Instance.Questions.GetNextQuestion();
            StartNewRound   = false;
            SetFullLife();
            FreePlaceholder = MAX_OBJECT;

            ActiveTrees = new List <GameObject>();

            List <ILivingLetterData> letterList = new List <ILivingLetterData>();

            foreach (var letter in currentQuestion.GetCorrectAnswers())
            {
                ILivingLetterData data = letter;
                if (HideAndSeekConfiguration.Instance.Variation == HideAndSeekVariation.Image)
                {
                    data = new LL_ImageData(data.Id);
                }

                letterList.Add(data);
            }

            int numWrong = Mathf.RoundToInt(2 + game.Difficulty * 4);

            foreach (var letter in currentQuestion.GetWrongAnswers())
            {
                if (numWrong-- == 0)
                {
                    break;
                }

                ILivingLetterData data = letter;
                if (HideAndSeekConfiguration.Instance.Variation == HideAndSeekVariation.Image)
                {
                    data = new LL_ImageData(data.Id);
                }

                letterList.Add(data);
            }

            ActiveLetters = letterList.Count;

            for (int i = 0; i < ActiveLetters; ++i)
            {
                int index = getRandomPlaceholder();
                if (index != -1)
                {
                    ActiveTrees.Add(ArrayTrees[index]);
                    Vector3 hiddenPosition = new Vector3(ArrayPlaceholder[index].transform.position.x, ArrayPlaceholder[index].transform.position.y - 3f, ArrayPlaceholder[index].transform.position.z + 3f);
                    ArrayLetters[i].transform.position = hiddenPosition;
                    HideAndSeekLetterController scriptComponent = ArrayLetters[i].GetComponent <HideAndSeekLetterController>();
                    scriptComponent.SetStartPosition(ArrayPlaceholder[index].transform.position);
                    scriptComponent.id = index;
                    SetLetterMovement(index, scriptComponent);
                    ArrayLetters[i].GetComponentInChildren <LivingLetterController>().Init(letterList[i]);

                    ArrayLetters[i].transform.DOMove(ArrayPlaceholder[index].transform.position, 0.5f);
                }
            }

            LockLetters(false);

            StartCoroutine(DisplayRound_Coroutine());
        }