public void PlaySfx(SFX_TYPE type) { for (int i = 0; i < SoundEffects.Length; i++) { if (SoundEffects[i].Type == type) { SoundEffects[i].Play(); return; } } }
public void playSFX(SFX_TYPE sfxType) { switch (sfxType) { case SFX_TYPE.PHONE_BEEP: this.SFXSource.clip = this.phoneBeepSFX; break; case SFX_TYPE.PLANE_SFX: this.SFXSource.clip = this.planeSFX; break; } this.SFXSource.Play(); }