Ejemplo n.º 1
0
    //Activates the extra speed for the given duration, then disables it
    private IEnumerator ExtraSpeedEffect()
    {
        levelGenerator.StartExtraSpeed(extraSpeedFactor);
        playerManager.ActivateExtraSpeed();

        //Declare variables, get the starting position, and move the object
        float i    = 0.0f;
        float rate = 1.0f / extraSpeedLength;

        while (i < 1.0)
        {
            //If the game is not paused, increase t
            if (!paused)
            {
                i += Time.deltaTime * rate;
            }

            //Wait for the end of frame
            yield return(0);
        }

        levelGenerator.EndExtraSpeed();
        playerManager.DisableExtraSpeed();
        guiManager.ShowAvailablePowerups();
    }