示例#1
0
 IEnumerator co_Lost()
 {
     if (status == LLStatus.StandingOnBelt)
     {
         status = LLStatus.Sad;
         LLController.DoAngry();
         yield return(new WaitForSeconds(1.5f));
     }
     Debug.Log(status);
     if (status != LLStatus.Flying || status != LLStatus.Falling || status != LLStatus.None)
     {
         LLController.Poof();
         yield return(new WaitForSeconds(0.2f));
     }
     else
     {
         yield return(new WaitForSeconds(2f));
     }
     transform.position = new Vector3(-100, -100, -100); // Move offscreen
 }
示例#2
0
        public EggRunLetter(GameObject letterObjectPrefab, GameObject shadowPrefab, ILivingLetterData letterData, Transform parent, Vector3 leftOutPosition, Vector3 rightOutPosition)
        {
            outPositions[0] = leftOutPosition;
            outPositions[1] = rightOutPosition;

            letterObject = UnityEngine.Object.Instantiate(letterObjectPrefab).GetComponent <LivingLetterController>();
            letterObject.transform.SetParent(parent);
            letterObject.Init(letterData);

            currentOutPosition = UnityEngine.Random.Range(0, 2);

            lerpPositionValue = currentOutPosition;

            letterObject.transform.position = outPositions[currentOutPosition];

            shadowTransform = UnityEngine.Object.Instantiate(shadowPrefab).transform;
            shadowTransform.SetParent(letterObject.transform);
            shadowTransform.localPosition = Vector3.zero;
            shadowTransform.localScale   *= 0.7f;

            letterObject.Poof();
        }
示例#3
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();
                }
            }
        }
示例#4
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();
                }
            }
        }
 public void Vanish()
 {
     letterObjectView.Poof();
     Disable();
 }