Example #1
0
    IEnumerator PowerUpCor(PowerUp.Type type, PowerupScr powerupPref)   // Контроль длительности действия паверапов
    {
        float duration     = powerUps[(int)type].Duration;
        float currDuration = duration;

        while (currDuration > 0)
        {
            powerupPref.SetProgress(currDuration / duration);

            if (GM.CanPlay)                     // Чтобы во время паузы не уменьшалось время паверапов
            {
                currDuration -= Time.deltaTime; // Уменьшение времени паверапов
            }
            yield return(null);
        }

        powerups.Remove(powerupPref);   // Удаляем паверап из списка
        powerupPref.Destroy();

        PowerUpReset(type);
    }
    IEnumerator PowerUpCor(PowerUp.Type type, PowerupScr powerupPref)
    {
        float duration     = powerUps[(int)type].Duration;
        float currDuration = duration;

        while (currDuration > 0)
        {
            powerupPref.SetProgress(currDuration / duration);

            if (GM.CanPlay)
            {
                currDuration -= Time.deltaTime;
            }

            yield return(null);
        }

        powerups.Remove(powerupPref);
        powerupPref.Destroy();

        PowerUpReset(type);
    }