コード例 #1
0
    private void ApplyPowerup(Powerup powerup)
    {
        if (activePowerup == powerup)
        {
            return;
        }

        // cancel any previously running powerups.
        if (activePowerup != null)
        {
            activePowerup.Cancel();
            Destroy(activePowerup.gameObject);
        }

        SoundManager.PlaySfx(powerup.collectedSfx);

        activePowerup = powerup;
        powerup.ApplyPowerup();
    }