Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (!dazzaController.IsDazzaDead() && !powerUpController.GetSpeedBoostActive())
     {
         if (dazzaController.IsGrounded())
         {
             if (thisAudioSource.clip == jump)
             {
                 thisAudioSource.clip = land;
                 thisAudioSource.Play();
             }
             else
             {
                 Running();
             }
         }
         else
         {
             if (thisAudioSource.clip != jump)
             {
                 thisAudioSource.clip = jump;
                 thisAudioSource.Play();
             }
         }
     }
     else
     {
         if (thisAudioSource.clip != dead)
         {
             thisAudioSource.clip = dead;
             thisAudioSource.Play();
         }
     }
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (dazzaController.IsDazzaDead() == false)
        {
            if (powerUpController.GetSpeedBoostActive())
            {
                if (powerUpController.GetHeadStartActive())
                {
                    currentDazzaAnimation = currentDazzaSkinHeadStart;

                    if (previousDazzaAnimation != currentDazzaAnimation)
                    {
                        ApplyCorrectAnimation();
                    }

                    previousDazzaAnimation = currentDazzaAnimation;
                }
                else
                {
                    currentDazzaAnimation = currentDazzaSkinSpeedBoost;

                    if (previousDazzaAnimation != currentDazzaAnimation)
                    {
                        ApplyCorrectAnimation();
                    }

                    previousDazzaAnimation = currentDazzaAnimation;
                }
            }
            else
            {
                if (dazzaController.IsGrounded() == false)
                {
                    if (dazzaController.GetJumping())
                    {
                        currentDazzaAnimation = currentDazzaSkinJump;
                    }
                    else
                    {
                        currentDazzaAnimation = currentDazzaSkinFall;
                    }
                }
                else
                {
                    currentDazzaAnimation = currentDazzaSkinAnimation;
                }


                if (previousDazzaAnimation != currentDazzaAnimation)
                {
                    ApplyCorrectAnimation();
                }
                previousDazzaAnimation = currentDazzaAnimation;
            }
        }
        else
        {
            if (dazzaController.IsDazzaBeingRevived())
            {
                Debug.Log("Play revive animation");
                currentDazzaAnimation = currentDazzaSkinRevive;

                if (previousDazzaAnimation != currentDazzaAnimation)
                {
                    ApplyCorrectAnimation();
                }
                previousDazzaAnimation = currentDazzaAnimation;
            }
            else
            {
                currentDazzaAnimation = currentDazzaSkinDeath;

                if (previousDazzaAnimation != currentDazzaAnimation)
                {
                    ApplyCorrectAnimation();
                }

                previousDazzaAnimation = currentDazzaAnimation;
            }
        }
    }