Beispiel #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();
         }
     }
 }
Beispiel #2
0
 void IncreaseGameSpeed()
 {
     if (!dazzaController.IsDazzaDead())
     {
         if (gameSpeed >= 30f)
         {
             gameSpeed = 30f;
         }
         else
         {
             gameSpeed += Time.deltaTime * rateGameSpeedIncreases;
         }
     }
 }
 // this calculates the speed the objects should be scrolling at based on the game speed
 void CalculateSpeed()
 {
     if (!dazzaController.IsDazzaDead())
     {
         levelScrollSpeed = gameController.GetGameSpeed() * levelScrollRate;
         lastGameSpeed    = levelScrollSpeed;
     }
     else
     {
         if (levelScrollRate != 1)
         {
             levelScrollSpeed = lastGameSpeed;
         }
         else
         {
             levelScrollSpeed = 0;
         }
     }
 }
Beispiel #4
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;
            }
        }
    }