Beispiel #1
0
 public void StopAllSE(float fDuration)
 {
     using (List <SoundManager.AudioSourceObserver> .Enumerator enumerator = this._listSEObserver.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             SoundManager.AudioSourceObserver current = enumerator.get_Current();
             current.Stop(false, fDuration);
         }
     }
 }
Beispiel #2
0
 public AudioSource PlaySE(AudioClip clip, bool isOneShot, Action onFinished)
 {
     using (List <SoundManager.AudioSourceObserver> .Enumerator enumerator = this._listSEObserver.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             SoundManager.AudioSourceObserver current = enumerator.get_Current();
             if (!current.source.get_isPlaying())
             {
                 return((!isOneShot) ? current.Play(clip, this._clsVolume.SE, isOneShot, onFinished).source : current.PlayOneShot(clip, this._clsVolume.SE).source);
             }
         }
     }
     return(null);
 }
Beispiel #3
0
 public AudioSource StopVoice(AudioSource source, bool isCallOnFinished, float fDuration)
 {
     if (source == null)
     {
         return(null);
     }
     using (List <SoundManager.AudioSourceObserver> .Enumerator enumerator = this._listVoiceObserver.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             SoundManager.AudioSourceObserver current = enumerator.get_Current();
             if (current.source == source)
             {
                 return(current.Stop(isCallOnFinished, fDuration).source);
             }
         }
     }
     return(null);
 }
Beispiel #4
0
 protected override void Awake()
 {
     base.Awake();
     this._clsBGMObserver = new SoundManager.AudioSourceObserver(base.get_transform().FindChild("BGM").AddComponent <AudioSource>());
     this._clsBGMObserver.source.set_priority(0);
     this._clsBGMObserver.source.set_playOnAwake(false);
     this._clsBGMObserver.source.set_loop(true);
     this._listVoiceObserver = new List <SoundManager.AudioSourceObserver>(18);
     for (int i = 0; i < 18; i++)
     {
         this._listVoiceObserver.Add(new SoundManager.AudioSourceObserver(base.get_transform().FindChild("Voice").AddComponent <AudioSource>()));
         this._listVoiceObserver.get_Item(i).source.set_playOnAwake(false);
         this._listVoiceObserver.get_Item(i).source.set_loop(false);
     }
     this._listSEObserver = new List <SoundManager.AudioSourceObserver>(18);
     for (int j = 0; j < 18; j++)
     {
         this._listSEObserver.Add(new SoundManager.AudioSourceObserver(base.get_transform().FindChild("SE").AddComponent <AudioSource>()));
         this._listSEObserver.get_Item(j).source.set_playOnAwake(false);
         this._listSEObserver.get_Item(j).source.set_loop(false);
     }
     this._clsVolume.Init(0.6f, 1f, 1f, false);
 }