Beispiel #1
0
    void PowerUpUse(PowerUp.type type)
    {
        PowerUpReset(type);
        PowerUpsCors[(int)type] = StartCoroutine(PowerUpCor(type));

        switch (type)
        {
        case PowerUp.type.MULTIPLIER:
            hs.PowerUpMultiplier = 2;
            break;

        case PowerUp.type.IMMORTALITY:
            hs.ImmortalityOn();
            break;

        case PowerUp.type.SPEEDRUN:
            hs.ImmortalityOn();
            hs.PowerUpSpeed = 2;
            break;

        case PowerUp.type.TIMESHIFT:
            hs.PowerUpSpeed = 0.5f;
            break;
        }
    }
Beispiel #2
0
    void PowerUpReset(PowerUp.type type)
    {
        if (PowerUpsCors[(int)type] != null)
        {
            StopCoroutine(PowerUpsCors[(int)type]);
        }
        else
        {
            return;
        }

        PowerUpsCors[(int)type] = null;

        switch (type)
        {
        case PowerUp.type.MULTIPLIER:
            hs.PowerUpMultiplier = 1;
            break;

        case PowerUp.type.IMMORTALITY:
            hs.ImmortalityOff();
            break;

        case PowerUp.type.SPEEDRUN:
            hs.ImmortalityOff();
            hs.PowerUpSpeed = 1;
            break;

        case PowerUp.type.TIMESHIFT:
            hs.PowerUpSpeed = 1;
            break;
        }
    }
Beispiel #3
0
    IEnumerator PowerUpCor(PowerUp.type type)
    {
        float duration = PowerUps[(int)type].Duration;

        while (duration > 0)
        {
            duration -= Time.deltaTime;
            yield return(null);
        }

        PowerUpReset(type);
    }