IEnumerator DeactivateRoutine() { OnPlaySFX?.Invoke(_explosionClip); _anim.SetTrigger("Explode"); yield return(new WaitForSeconds(_destroyDelay)); gameObject.SetActive(false); }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { Player player = OnGetPlayerScript?.Invoke(); if (player != null) { OnPlaySFX?.Invoke(_powerUpClip); switch (_powerUpType) { case PowerUpType.TripleShot: player.TripleShotActivate(); break; case PowerUpType.SpeedBoost: player.SpeedBoostActivate(); break; case PowerUpType.Shield: player.ShieldActivate(); break; case PowerUpType.Ammo: player.ChangeAmmo(); break; case PowerUpType.Health: player.ChangeLives(_healAmount); break; case PowerUpType.Missile: player.ActivateHomingMissiles(); break; case PowerUpType.OmniShot: player.OmniShotActivate(); break; case PowerUpType.Negative: player.ChangeLives(-_healAmount); player.NegativeEffectActivate(); break; default: break; } } gameObject.SetActive(false); } }
public void PlayClip(AudioClip clip) { OnPlaySFX?.Invoke(clip); }
protected void PlayClip(AudioClip clip) { OnPlaySFX?.Invoke(clip); }