public void PlaySfx(SfxEnum sfxEnum) { var sfxClip = sfxClipInstanceArr[(int)sfxEnum]; if (sfxClip != null) { sfxSource.PlayOneShot(sfxClip.Clip); } }
public static void PlaySfxAtLocation(SfxEnum sfxEnum, Vector3 location) { if (instance) { instance.PlaySfxInstance(sfxEnum, location); } else { Debug.LogError("SfxPlayer: No instance refernce"); } }
public static void PlaySfx(SfxEnum sfxEnum) { if (instance) { instance.PlaySfxInstance(sfxEnum, Vector3.zero); } else { Debug.LogError("SfxPlayer: No instance refernce"); } }
private void PlaySfxInstance(SfxEnum sfxEnum, Vector3 location) { AudioClip targetClip = null; sfxDictionary.TryGetValue(sfxEnum, out targetClip); if (targetClip) { AudioSource.PlayClipAtPoint(targetClip, location, volume); } else { Debug.LogError("SfxPlayer: Clip not found"); } }