示例#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 SoundEmitter GetEmitter(SFXController.Sounds sound)
 {
     foreach (SoundEmitter soundEmitter in this.emitters)
     {
         if (soundEmitter.sound == sound)
         {
             return(soundEmitter);
         }
     }
     Debug.Log(string.Format("There is no sound emitter created for {0}", sound), this);
     return(null);
 }