private void OnTriggerEnter(Collider other) { switch (other.gameObject.tag) { case Tags.POWERUP: Powerup powerup = other.GetComponent <Powerup>(); switch (powerup.GetPowerupType()) { case PowerupType.BonusPoints: PlayerScore.instance.AddBonusPoints(500); AudioManager.instance.Play(SoundNames.BONUS_POINTS); PlayerHud.instance.ShowNotification(powerup.GetColour(), "+500!"); break; case PowerupType.DoublePoints: PlayerScore.instance.DoublePoints(); AudioManager.instance.Play(SoundNames.DOUBLE_POINTS); PlayerHud.instance.ShowNotification(powerup.GetColour(), "x2!"); break; case PowerupType.Invincibility: if (godModeRoutine != null) { StopCoroutine(godModeRoutine); } godModeRoutine = StartCoroutine(ActivateGodMode(5f)); AudioManager.instance.Play(SoundNames.INVINCIBILITY_POINTS); PlayerHud.instance.ShowNotification(powerup.GetColour(), "Invincible!"); break; default: Debug.Log("Warning! Unrecognised Powerup type: " + powerup.GetPowerupType()); break; } powerup.Relocate(); break; default: // Nothing to do! break; } }