예제 #1
0
        private IEnumerator ShowWinSequence(LetterController correctLetterCntrl)
        {
            yield return(new WaitForSeconds(0.1f));

            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);

            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.lettersinword)
            {
                correctLetterCntrl.SetLetter(question);
            }

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

            AudioManager.I.PlaySfx(Sfx.Win);

            yield return(new WaitForSeconds(3f));

            OnRoundConcluded();
        }
예제 #2
0
        public void EnterState()
        {
            UnityEngine.Random.InitState(DateTime.Now.GetHashCode());

            // Layer 8 = Terrain. Layer 12 = Ball.
            Physics.IgnoreLayerCollision(8, 10);

            letterSpawner = new LetterSpawner();

            foreach (Collider collider in ThrowBallsGame.instance.environment.GetComponentsInChildren <Collider>())
            {
                collider.enabled = false;
            }

            letterPool        = new GameObject[NUM_LETTERS_IN_POOL];
            letterControllers = new LetterController[NUM_LETTERS_IN_POOL];

            for (int i = 0; i < letterPool.Length; i++)
            {
                GameObject       letter           = ThrowBallsGame.Instantiate(game.letterWithPropsPrefab).GetComponent <LetterWithPropsController>().letter;
                LetterController letterController = letter.GetComponent <LetterController>();

                letterPool[i]        = letter;
                letterControllers[i] = letterController;

                letter.SetActive(false);
            }

            ThrowBallsGame.instance.letterWithPropsPrefab.SetActive(false);

            //ResetScene();

            switch (ThrowBallsConfiguration.Instance.Variation)
            {
            case ThrowBallsVariation.letters:
                audioManager.PlayDialogue(Db.LocalizationDataId.ThrowBalls_letters_Title, OnTitleVoiceOverDone);
                break;

            case ThrowBallsVariation.words:
                audioManager.PlayDialogue(Db.LocalizationDataId.ThrowBalls_words_Title, OnTitleVoiceOverDone);
                break;

            case ThrowBallsVariation.lettersinword:
                audioManager.PlayDialogue(Db.LocalizationDataId.ThrowBalls_letterinword_Title, OnTitleVoiceOverDone);
                break;

            default:
                break;
            }

            AudioManager.I.PlayMusic(Music.Theme10);
        }
예제 #3
0
        public void OnCorrectLetterHit(LetterController correctLetterCntrl)
        {
            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.lettersinword && --numLettersRemaining != 0)
            {
                UpdateLettersForLettersInWord(correctLetterCntrl);
                OnBallLost();
                BallController.instance.Reset();
            }

            else if (isRoundOngoing)
            {
                if (roundNumber > 0)
                {
                    numRoundsWon++;

                    if (numRoundsWon == 1)
                    {
                        MinigamesUI.Starbar.GotoStar(0);
                    }

                    else if (numRoundsWon == 3)
                    {
                        MinigamesUI.Starbar.GotoStar(1);
                    }

                    else if (numRoundsWon == 5)
                    {
                        MinigamesUI.Starbar.GotoStar(2);
                    }
                }

                else
                {
                    TutorialUI.Clear(true);
                }

                game.StartCoroutine(ShowWinSequence(correctLetterCntrl));
                BallController.instance.Disable();

                isRoundOngoing = false;
            }
        }
예제 #4
0
        private void UpdateLettersForLettersInWord(LetterController correctLetterCntrl)
        {
            correctLetterCntrl.Vanish();
            correctLetterCntrl.Reset();

            ILivingLetterData newCorrectLetter = letterControllers[numLetters - numLettersRemaining].GetLetter();

            for (int i = numLetters - numLettersRemaining; i < numLetters; i++)
            {
                if (letterControllers[i].GetLetter().Id == newCorrectLetter.Id)
                {
                    letterPool[i].tag = Constants.TAG_CORRECT_LETTER;
                }

                else
                {
                    letterPool[i].tag = Constants.TAG_WRONG_LETTER;
                }
            }
        }