Example #1
0
    PowerUpScr createPowerUpPref(PowerUp.Type type)
    {
        GameObject go = Instantiate(PowerUpPref, PowerUpGrid, false);

        PowerUpScr p = go.GetComponent <PowerUpScr>();

        powerups.Add(p);

        p.SetData(type);

        return(p);
    }
Example #2
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);
    }