public void Update(float delta)
        {
            CalcPercentageLetterColored();

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

                if (m_fDisappearTimeProgress >= m_fTimeToDisappear) //after the given time is reached
                {
                    m_LetterObjectView.Poof();                      //LL vanishes

                    //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) //else check for letter completed
            {
                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();

                AudioManager.I.PlayLetter(m_LetterObjectView.Data.Id); //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();
                AudioManager.I.PlaySfx(Sfx.Win);

                //play win particle
                game.winParticle.SetActive(true);
                foreach (var particles in game.winParticle.GetComponentsInChildren <ParticleSystem>(true))
                {
                    particles.Play();
                }
            }
        }
Exemple #2
0
        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);

                game.SetCurrentState(game.TutorialState);
            }
        }
        public void Update(float delta)
        {
            if (m_Rounds <= 0)
            {
                game.SetCurrentState(game.ResultState);
            }
            else
            {
                CalcPercentageLetterColored();

                if (m_PercentageLetterColoredButton != null)
                {
                    m_PercentageLetterColoredButton.GetComponentInChildren <Text>().text = Mathf.FloorToInt(m_PercentageLetterColored) + "%";
                }

                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

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

                        --m_Rounds;
                        if (m_Rounds > 0) //activate next LL
                        {
                            ResetState();
                            m_ColorsUIManager.ChangeButtonsColor();
                            m_CurrentLetter = game.myLetters[m_Rounds - 1];
                            m_CurrentLetter.gameObject.SetActive(true);
                            // Initialize the next letter
                            InitLetter();
                        }
                    }
                }
                else if (m_PercentageLetterColored >= 100 || 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();

                    AudioManager.I.PlayLetter(m_LetterObjectView.Data.Id); //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.starsAwarded     = Mathf.CeilToInt(m_iRoundsSuccessfull / 2f);
                        game.gameUI.SetStarsScore(game.starsAwarded);

                        m_LetterObjectView.DoHorray();
                        AudioManager.I.PlaySfx(Sfx.Win);

                        //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();
                        AudioManager.I.PlaySfx(Sfx.Lose);
                    }
                }
            }
        }