private void OnPowerupPickup(PowerupPickup onPowerupPickupEvent) { _powerupActivatedThisRun = true; if (_activePowerup != Enums.PowerupType.None) { Events.instance.Raise(new PowerupEnded(_activePowerup, true)); } var poww = PowerupManager.GetPowerup(onPowerupPickupEvent.powerup); _activePowerup = poww.powerupType; if (poww.Duration > 0) { StartCoroutine("PowerupCountdown", (float)poww.Duration); } switch (_activePowerup) { case Enums.PowerupType.Bubble: BubblePowerup(); break; case Enums.PowerupType.FillHp: PlayerHealth += 1; break; case Enums.PowerupType.Grail: IncreaseMultiplier(4); freezeMultiplierTimer = true; break; case Enums.PowerupType.Sword: boat.GetComponent <Renderer>().material = boatPowerupMat; _canTakeHit = 1; break; case Enums.PowerupType.TemporaryHp: TempHealth += 1; break; case Enums.PowerupType.Windmill: paddle.GetComponent <Renderer>().material = paddlePowerupMat; Events.instance.Raise(new TurningSpeedChanged(true)); break; case Enums.PowerupType.MoneyBag: Events.instance.Raise(new CoinPowerup(10)); break; } }
private void OnPowerupPickedUp(PowerupPickup powerupPickup) { Activate(); _powerupElapsedTime = 0; _faderElapsedTime = 0; var activePowerup = PowerupManager.GetPowerup(powerupPickup.powerup); _duration = activePowerup.Duration; if (_duration <= 0) { StopCoroutine("PowerupTimer"); StartCoroutine("FadeTimer", fadeTime); } else { StopCoroutine("FadeTimer"); StartCoroutine("PowerupTimer", _duration); } _image.sprite = _powerupAssetList.GetSprite(activePowerup.powerupType); }
private void OnPowerupPickup(PowerupPickup onPowerupPickupEvent) { PowerupAudio.clip = powerupActivateSounds[(int)(onPowerupPickupEvent.powerup - 1)]; PowerupAudio.Play(); }