public static void PlaySound(SFXController.Sounds sound) { SoundEmitter emitter = SFXController.Instance.GetEmitter(sound); AudioSource source = emitter.GetSource(); if (!source.isPlaying || emitter.interupt) { source.clip = SFXController.Instance.GetRandomClip(emitter); source.Play(); } }
private AudioClip GetRandomClip(SoundEmitter emitter) { int index = UnityEngine.Random.Range(0, emitter.clips.Count); return(emitter.clips[index]); }