Exemple #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();
         }
     }
 }
Exemple #2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("WouldKillDazza") && !powerUpController.GetSpeedBoostActive())
     {
         Debug.Log("Fart");
         other.gameObject.GetComponent <Collider2D>().enabled = false;
         deactivate           = true;
         thisSR.enabled       = false;
         thisAudioSource.clip = deactivateSound;
         thisAudioSource.loop = false;
         thisAudioSource.Play();
     }
 }
    // 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;
            }
        }
    }