void ShieldUp(Powerup powerup) { // Only display shield image if there isn't one active already (prevents duplicates) if (!Powerup.GetShield()) { shieldImage = Instantiate(shieldPrefab, transform.position, Quaternion.identity) as GameObject; } Powerup.SetShield(true); AudioSource.PlayClipAtPoint(shieldUp, transform.position); powerup.Collected(); }
void SpeedBoostOn(Powerup powerup) { // Player cannot stack speed boosts if (Powerup.GetSpeedBoost() != true) { Powerup.SetSpeedBoost(true); globalTime = Time.time; speed *= 2; fireRate /= 2; AudioSource.PlayClipAtPoint(speedBoostOn, transform.position); } powerup.Collected(); }