Пример #1
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)
            {
                correctLetterCntrl.SetLetter(question);
            }

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

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

            yield return(new WaitForSeconds(3f));

            correctLetterCntrl.HideVictoryRays();

            OnRoundConcluded();
        }
Пример #2
0
        public void EnterState()
        {
            Random.InitState(DateTime.Now.GetHashCode());

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

            // Layer 16 = Slingshot; Layer 10 = Player (Antura).
            Physics.IgnoreLayerCollision(16, 10);

            // Layer 16 = Slingshot; Layer 12 = Ball.
            Physics.IgnoreLayerCollision(16, 12);

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

            BallController.instance.Reset();
            Catapult.instance.DisableCollider();
            BallController.instance.Disable();
            SlingshotController.instance.Disable();
            AnturaController.instance.Disable();
            ArrowHeadController.instance.Disable();
            ArrowBodyController.instance.Disable();

            AudioManager.I.PlayMusic(Music.Theme10);

            SlingshotController.instance.Enable();
            GameObject poof = UnityEngine.Object.Instantiate(ThrowBallsGame.instance.poofPrefab, SlingshotController.instance.transform.position + new Vector3(0f, -5f, -2f), Quaternion.identity);

            UnityEngine.Object.Destroy(poof, 10);
            ThrowBallsConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.Poof);

            game.PlayIntro(OnIntroVoiceOverDone);
        }
Пример #3
0
        public void OnCorrectLetterHit(LetterController correctLetterCntrl)
        {
            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.BuildWord)
            {
                numLettersRemaining--;
                var word = ((LL_WordData)question).Data;

                if (flashingTextCoroutine != null)
                {
                    ThrowBallsGame.instance.StopCoroutine(flashingTextCoroutine);
                }

                if (numLettersRemaining == 0)
                {
                    string markedText = ArabicTextUtilities.GetWordWithMarkedText(word, Color.green);
                    UIController.instance.SetText(markedText);
                }
                else
                {
                    var letterToFlash = (LL_LetterData)currentLettersForLettersInWord[currentLettersForLettersInWord.Count - numLettersRemaining];
                    int numTimesLetterHasBeenFlashed = flashedLettersInLiWVariation.Count(x => x.Id == letterToFlash.Id);
                    var letterDataToFlash            = ArabicAlphabetHelper.FindLetter(AppManager.I.DB, word, letterToFlash.Data, false)[numTimesLetterHasBeenFlashed];
                    flashedLettersInLiWVariation.Add(letterToFlash);

                    flashingTextCoroutine = ArabicTextUtilities.GetWordWithFlashingText(word, letterDataToFlash.fromCharacterIndex, letterDataToFlash.toCharacterIndex, Color.green, FLASHING_TEXT_CYCLE_DURATION, int.MaxValue,
                                                                                        (string text) => {
                        UIController.instance.SetText(text);
                    }, true);

                    ThrowBallsGame.instance.StartCoroutine(flashingTextCoroutine);
                }

                UIController.instance.WobbleLetterHint();

                if (numLettersRemaining != 0)
                {
                    UpdateLettersForLettersInWord(correctLetterCntrl);
                    BallController.instance.DampenVelocity();
                }
                else
                {
                    OnRoundWon(correctLetterCntrl);
                }
            }
            else
            {
                OnRoundWon(correctLetterCntrl);
            }
        }
Пример #4
0
        public void EnterState()
        {
            Random.InitState(DateTime.Now.GetHashCode());

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

            // Layer 16 = Slingshot; Layer 10 = Player (Antura).
            Physics.IgnoreLayerCollision(16, 10);

            // Layer 16 = Slingshot; Layer 12 = Ball.
            Physics.IgnoreLayerCollision(16, 12);

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

            audioManager.PlayDialogue(ThrowBallsConfiguration.Instance.TitleLocalizationId, OnTitleVoiceOverDone);

            AudioManager.I.PlayMusic(Music.Theme10);

            BallController.instance.Reset();
            Catapult.instance.DisableCollider();
            BallController.instance.Disable();
            SlingshotController.instance.Disable();
            AnturaController.instance.Disable();
            ArrowHeadController.instance.Disable();
            ArrowBodyController.instance.Disable();
        }
Пример #5
0
        public void OnCorrectLetterHit(LetterController correctLetterCntrl)
        {
            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.BuildWord)
            {
                numLettersRemaining--;
                var word = ((LL_WordData)question).Data;

                if (flashingTextCoroutine != null)
                {
                    ThrowBallsGame.instance.StopCoroutine(flashingTextCoroutine);
                }

                if (numLettersRemaining == 0)
                {
                    string markedText = ArabicTextUtilities.GetWordWithMarkedText(word, Color.green);
                    UIController.instance.SetText(markedText);
                }
                else
                {
                    var letterToFlash = (LL_LetterData)currentLettersForLettersInWord[currentLettersForLettersInWord.Count - numLettersRemaining];

                    FlashLetter(letterToFlash);

                    ThrowBallsGame.instance.StartCoroutine(flashingTextCoroutine);
                }

                UIController.instance.WobbleLetterHint();

                if (numLettersRemaining != 0)
                {
                    UpdateLettersForLettersInWord(correctLetterCntrl);
                    BallController.instance.DampenVelocity();
                }
                else
                {
                    OnRoundWon(correctLetterCntrl);
                }
            }
            else
            {
                OnRoundWon(correctLetterCntrl);
            }
        }
Пример #6
0
        private void UpdateLettersForLettersInWord(LetterController correctLetterCntrl)
        {
            correctLetterCntrl.Vanish();
            correctLetterCntrl.Reset();

            ILivingLetterData newCorrectLetter = currentLettersForLettersInWord[currentLettersForLettersInWord.Count - numLettersRemaining];

            for (int i = currentLettersForLettersInWord.Count - 1; i >= 0; i--)
            {
                if (letterControllers[i].GetLetter().Id == newCorrectLetter.Id && letterPool[i].activeSelf)
                {
                    letterPool[i].tag = Constants.CORRECT_LETTER_TAG;
                    tutorialTarget    = letterPool[i];
                }
                else
                {
                    letterPool[i].tag = Constants.WRONG_LETTER_TAG;
                }
            }
        }
Пример #7
0
        private void OnRoundWon(LetterController correctLetterCntrl)
        {
            if (isRoundOngoing)
            {
                if (!IsTutorialRound())
                {
                    game.CurrentScore++;
                }
                else
                {
                    TutorialUI.Clear(true);
                }

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

                isRoundOngoing = false;

                game.Context.GetLogManager().OnAnswered(question, true);
            }
        }
Пример #8
0
        public void OnCorrectLetterHit(LetterController correctLetterCntrl)
        {
            hitCorrect = true;
            if (ThrowBallsConfiguration.Instance.Variation == ThrowBallsVariation.BuildWord)
            {
                numLettersRemaining--;
                var word = ((LL_WordData)question).Data;

                UIController.instance.LabelRender.StopFlashing();

                if (numLettersRemaining == 0)
                {
                    string markedText = LanguageSwitcher.LearningHelper.GetWordWithMarkedText(word, Color.green);
                    UIController.instance.SetText(markedText);
                }
                else
                {
                    var letterToFlash = (LL_LetterData)currentLettersForLettersInWord[currentLettersForLettersInWord.Count - numLettersRemaining];

                    FlashLetter(letterToFlash);
                }

                UIController.instance.WobbleLetterHint();

                if (numLettersRemaining != 0)
                {
                    UpdateLettersForLettersInWord(correctLetterCntrl);
                    BallController.instance.DampenVelocity();
                }
                else
                {
                    OnRoundWon(correctLetterCntrl);
                }
            }
            else
            {
                OnRoundWon(correctLetterCntrl);
            }
        }
Пример #9
0
        private void ConfigureLetterPropAndMotionVariation(LetterController letterController, LetterAnimationMode mode)
        {
            if (IsTutorialRound())
            {
                letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                letterController.SetPropVariation(LetterController.PropVariation.Nothing);
                return;
            }

            switch (mode)
            {
            case LetterAnimationMode.IdleGround:
                letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                letterController.SetPropVariation(LetterController.PropVariation.Nothing);
                break;

            case LetterAnimationMode.JumpGround:
                letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
                letterController.SetPropVariation(LetterController.PropVariation.Nothing);
                break;

            case LetterAnimationMode.IdleCrate:
                letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                letterController.SetPropVariation(LetterController.PropVariation.StaticPileOfCrates);
                break;

            case LetterAnimationMode.JumpCrate:
                letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
                letterController.SetPropVariation(LetterController.PropVariation.StaticPileOfCrates);
                break;

            case LetterAnimationMode.IdleSwerving:
                letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                letterController.SetPropVariation(LetterController.PropVariation.SwervingPileOfCrates);
                break;

            case LetterAnimationMode.JumpSwerving:
                letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
                letterController.SetPropVariation(LetterController.PropVariation.SwervingPileOfCrates);
                break;

            case LetterAnimationMode.Bush:
                letterController.SetMotionVariation(LetterController.MotionVariation.Popping);
                letterController.SetPropVariation(LetterController.PropVariation.Bush);
                break;
            }

            /*
             * if (game.Difficulty <= MiniGameController.VERY_EASY)
             * {
             *  letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
             *  letterController.SetPropVariation(LetterController.PropVariation.Nothing);
             * }
             * else if (game.Difficulty <= MiniGameController.EASY)
             * {
             *  if (game.CurrentScore < 2)
             *  {
             *      letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
             *      letterController.SetPropVariation(LetterController.PropVariation.Nothing);
             *  }
             *  else
             *  {
             *      letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
             *      letterController.SetPropVariation(LetterController.PropVariation.Nothing);
             *  }
             * }
             * else if (game.Difficulty <= MiniGameController.NORMAL)
             * {
             *  if (game.CurrentScore < 1)
             *  {
             *      letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
             *      letterController.SetPropVariation(LetterController.PropVariation.Nothing);
             *  }
             *  else if (game.CurrentScore < 3)
             *  {
             *      letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
             *      letterController.SetPropVariation(LetterController.PropVariation.StaticPileOfCrates);
             *  }
             *  else
             *  {
             *      letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
             *      letterController.SetPropVariation(LetterController.PropVariation.StaticPileOfCrates);
             *  }
             * }
             * else if (game.Difficulty <= MiniGameController.HARD)
             * {
             *  if (roundNumber < 4)
             *  {
             *      if (Random.value <= 0.5f)
             *      {
             *          letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
             *          letterController.SetPropVariation(LetterController.PropVariation.StaticPileOfCrates);
             *      }
             *      else
             *      {
             *          letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
             *          letterController.SetPropVariation(LetterController.PropVariation.SwervingPileOfCrates);
             *      }
             *  }
             *  else
             *  {
             *      if (Random.value <= 0.6f)
             *      {
             *          letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
             *          letterController.SetPropVariation(LetterController.PropVariation.SwervingPileOfCrates);
             *      }
             *      else
             *      {
             *          letterController.SetMotionVariation(LetterController.MotionVariation.Popping);
             *          letterController.SetPropVariation(LetterController.PropVariation.Bush);
             *      }
             *  }
             * }
             * else if (game.Difficulty <= MiniGameController.VERY_HARD)
             * {
             *  if (Random.value <= 0.4f)
             *  {
             *      letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
             *      letterController.SetPropVariation(LetterController.PropVariation.SwervingPileOfCrates);
             *  }
             *  else
             *  {
             *      letterController.SetMotionVariation(LetterController.MotionVariation.Popping);
             *      letterController.SetPropVariation(LetterController.PropVariation.Bush);
             *  }
             * }*/
        }
Пример #10
0
 public void OnWrongLetterHit(LetterController wrongLetterCntrl)
 {
 }
Пример #11
0
        private void ConfigureLetterPropAndMotionVariation(LetterController letterController)
        {
            if (IsTutorialRound())
            {
                letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                letterController.SetPropVariation(LetterController.PropVariation.Nothing);
                return;
            }

            switch (game.Difficulty)
            {
            case ThrowBallsGame.ThrowBallsDifficulty.VeryEasy:
                letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                letterController.SetPropVariation(LetterController.PropVariation.Nothing);
                break;

            case ThrowBallsGame.ThrowBallsDifficulty.Easy:
                if (numRoundsWon < 2)
                {
                    letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                    letterController.SetPropVariation(LetterController.PropVariation.Nothing);
                }
                else
                {
                    letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
                    letterController.SetPropVariation(LetterController.PropVariation.Nothing);
                }
                break;

            case ThrowBallsGame.ThrowBallsDifficulty.Normal:
                if (numRoundsWon < 1)
                {
                    letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
                    letterController.SetPropVariation(LetterController.PropVariation.Nothing);
                }
                else if (numRoundsWon < 3)
                {
                    letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                    letterController.SetPropVariation(LetterController.PropVariation.StaticPileOfCrates);
                }
                else
                {
                    letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
                    letterController.SetPropVariation(LetterController.PropVariation.StaticPileOfCrates);
                }
                break;

            case ThrowBallsGame.ThrowBallsDifficulty.Hard:
                if (roundNumber < 4)
                {
                    if (Random.value <= 0.5f)
                    {
                        letterController.SetMotionVariation(LetterController.MotionVariation.Jumping);
                        letterController.SetPropVariation(LetterController.PropVariation.StaticPileOfCrates);
                    }
                    else
                    {
                        letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                        letterController.SetPropVariation(LetterController.PropVariation.SwervingPileOfCrates);
                    }
                }
                else
                {
                    if (Random.value <= 0.6f)
                    {
                        letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                        letterController.SetPropVariation(LetterController.PropVariation.SwervingPileOfCrates);
                    }
                    else
                    {
                        letterController.SetMotionVariation(LetterController.MotionVariation.Popping);
                        letterController.SetPropVariation(LetterController.PropVariation.Bush);
                    }
                }
                break;

            case ThrowBallsGame.ThrowBallsDifficulty.VeryHard:
                if (Random.value <= 0.4f)
                {
                    letterController.SetMotionVariation(LetterController.MotionVariation.Idle);
                    letterController.SetPropVariation(LetterController.PropVariation.SwervingPileOfCrates);
                }
                else
                {
                    letterController.SetMotionVariation(LetterController.MotionVariation.Popping);
                    letterController.SetPropVariation(LetterController.PropVariation.Bush);
                }
                break;
            }
        }