public void Update(float delta)
        {
            timer -= delta;

            if (timer < 0)
            {
                for (int i = 0; i < game.rounds; ++i)
                {
                    game.myLetters[i].gameObject.SetActive(false);
                }
                game.tutorialLetter.gameObject.SetActive(false);

                if (PerformTutorial)
                {
                    game.SetCurrentState(game.TutorialState);
                }
                else
                {
                    game.SetCurrentState(game.PlayState);
                }
            }
        }
Example #2
0
        public void Update(float delta)
        {
            bool stillWaitForInput = !(m_HitStateLLController != null && m_HitStateLLController.hitState == eHitState.HIT_LETTEROUTSIDE) && (m_TMPTextColoringLetter != null && m_TMPTextColoringLetter.IsTouching);

            CalcPercentageLetterColored();

            if (m_bLLVanishing)
            {
                m_fDisappearTimeProgress += Time.deltaTime;

                if (m_fDisappearTimeProgress >= m_fTimeToDisappear)
                {
                    m_LetterObjectView.Poof(); //LL vanishes
                    game.Context.GetAudioManager().PlaySound(Sfx.Poof);

                    //stop win particle
                    foreach (var particles in game.winParticle.GetComponentsInChildren <ParticleSystem>(true))
                    {
                        particles.Stop();
                    }
                    game.winParticle.SetActive(false);

                    m_bLLVanishing           = false;
                    m_fDisappearTimeProgress = 0;

                    //just for possible reusing of the LL renable components
                    EnableLetterComponents();

                    m_TutorialLetter.SetActive(false);

                    game.SetCurrentState(game.PlayState);
                }
            }
            else if (m_PercentageLetterColored >= 100 && !stillWaitForInput)
            {
                game.tutorialUIManager.StartTutorial = false;

                game.anturaController.ForceAnturaToGoBack(); //we completed the letter, antura turn back

                m_bLLVanishing = true;                       //LL is about to disappear

                //disable color components to avoid input in this phase (or ignore input using touch manager?)
                DisableLetterComponents();

                game.Context.GetAudioManager().PlayVocabularyData(
                    m_LetterObjectView.Data,
                    soundType: ColorTickleConfiguration.Instance.GetVocabularySoundType()
                    );                           //play letter pronounce again

                m_SurfaceColoringLetter.Reset(); //reset to clean surface of LL (maybe make a function to clean it rather than reinitialize it)


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

                //play win particle
                game.winParticle.SetActive(true);
                foreach (var particles in game.winParticle.GetComponentsInChildren <ParticleSystem>(true))
                {
                    particles.Play();
                }
            }
        }
Example #3
0
        public void Update(float delta)
        {
            tryAnturaTimer -= delta;

            if (m_Rounds <= 0 || game.starsAwarded >= 3)
            {
                game.SetCurrentState(game.ResultState);
            }
            else
            {
                bool stillWaitForInput = !(m_HitStateLLController != null && m_HitStateLLController.hitState == eHitState.HIT_LETTEROUTSIDE) && (m_TMPTextColoringLetter != null && m_TMPTextColoringLetter.IsTouching);

                CalcPercentageLetterColored();

                if (m_bLLVanishing) //if the LL is about to vanish
                {
                    m_fDisappearTimeProgress += Time.deltaTime;

                    //if(m_LetterObjectView.GetState()!=LLAnimationStates.LL_dancing)//when the dance is finished ---> DoDancingWin/Lose do not exit from this state
                    if (m_fDisappearTimeProgress >= m_fTimeToDisappear) //after the given time is reached
                    {
                        m_LetterObjectView.Poof();                      //LL vanishes
                        game.Context.GetAudioManager().PlaySound(Sfx.Poof);

                        //stop win particle
                        foreach (var particles in game.winParticle.GetComponentsInChildren <ParticleSystem>(true))
                        {
                            particles.Stop();
                        }
                        game.winParticle.SetActive(false);

                        m_bLLVanishing           = false;
                        m_fDisappearTimeProgress = 0;

                        //just for possible reusing of the LL renable components
                        EnableLetterComponents();

                        m_CurrentLetter.SetActive(false);
                        var controller = m_CurrentLetter.GetComponent <HitStateLLController>();
                        if (controller != null)
                        {
                            controller.OnTouchedOutside -= OnTickled;
                            controller.OnTouchedShape   -= TryEnableAntura;
                        }

                        --m_Rounds;
                        if (m_Rounds > 0) //activate next LL
                        {
                            ResetState();
                            m_ColorsUIManager.ChangeButtonsColor();
                            tickled         = false;
                            m_CurrentLetter = game.myLetters[m_Rounds - 1];
                            m_CurrentLetter.gameObject.SetActive(true);
                            // Initialize the next letter
                            InitLetter();
                        }
                    }
                }
                else if ((m_PercentageLetterColored >= 100 && !stillWaitForInput) || m_Lives <= 0) //else check for letter completed
                {
                    game.anturaController.ForceAnturaToGoBack();                                   //we completed the letter, antura turn back
                    m_bLLVanishing = true;                                                         //LL is about to disappear

                    //disable color components to avoid input in this phase (or ignore input using touch manager?)
                    DisableLetterComponents();

                    ColorTickleConfiguration.Instance.Context.GetAudioManager().PlayVocabularyData(
                        m_LetterObjectView.Data,
                        soundType: ColorTickleConfiguration.Instance.GetVocabularySoundType()
                        );                           //play letter pronounce again

                    m_SurfaceColoringLetter.Reset(); //reset to clean surface of LL (maybe make a function to clean it rather than reinitialize it)

                    //LL does win or lose animation
                    if (m_PercentageLetterColored >= 100)
                    {
                        m_iRoundsSuccessfull += 1;
                        game.CurrentScore     = m_iRoundsSuccessfull;

                        m_LetterObjectView.DoHorray();
                        ColorTickleConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.Win);

                        game.Context.GetLogManager().OnAnswered(m_LetterObjectView.Data, true);

                        //play win particle
                        game.winParticle.SetActive(true);
                        foreach (var particles in game.winParticle.GetComponentsInChildren <ParticleSystem>(true))
                        {
                            particles.Play();
                        }
                    }
                    else if (m_Lives <= 0)
                    {
                        /*m_LetterObjectView.DoDancingLose(); //this just set trigger for lose on dancing animation
                         * m_LetterObjectView.SetState(LLAnimationStates.LL_dancing);*/
                        m_LetterObjectView.DoAngry();
                        game.Context.GetLogManager().OnAnswered(m_LetterObjectView.Data, false);
                        game.Context.GetAudioManager().PlaySound(Sfx.LetterAngry);
                        game.Context.GetAudioManager().PlaySound(Sfx.Lose);
                    }
                }
                else if (tickled)
                {
                    tickled = false;
                    if (m_CurrentLetter != null)
                    {
                        m_CurrentLetter.GetComponent <HitStateLLController>().TicklesLetter();
                    }
                    LoseLife();
                }
            }
        }