コード例 #1
0
        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();
            }
        }
コード例 #2
0
        private AudioClip GetRandomClip(SoundEmitter emitter)
        {
            int index = UnityEngine.Random.Range(0, emitter.clips.Count);

            return(emitter.clips[index]);
        }