public AudioSource PlayLongVoiceAudio(AudioClip adClip) { if (adClip == null) { return(null); } AudioSource adio = LongVoiceAudioSourceQueue.Dequeue(); adio.clip = adClip; adio.Play(); LongVoiceAudioSourceQueue.Enqueue(adio); return(adio); }
public AudioSource PlayLongVoiceAudio(AudioClip adClip) { if (null == adClip) { return(null); } AudioSource ads = LongVoiceAudioSourceQueue.Dequeue(); ads.clip = adClip; // ads.volume = 1; ads.Play(); EffectAudioSourceQueue.Enqueue(ads); return(ads); }
public void EnableSound(bool enable) { if (HeroMoveAudio.enabled != enable) { if (enable) { HeroMoveAudio.clip = null; } HeroMoveAudio.enabled = enable; } if (GuideVoice.enabled != enable) { if (enable) { GuideVoice.clip = null; } GuideVoice.enabled = enable; } for (int i = 0; i < EffectAudioSourceQueue.Count; i++) { if (EffectAudioSourceQueue.ElementAt(i).enabled != enable) { if (enable) { EffectAudioSourceQueue.ElementAt(i).clip = null; } EffectAudioSourceQueue.ElementAt(i).enabled = enable; } } for (int i = 0; i < LongVoiceAudioSourceQueue.Count; i++) { if (LongVoiceAudioSourceQueue.ElementAt(i).enabled != enable) { if (enable) { LongVoiceAudioSourceQueue.ElementAt(i).clip = null; } LongVoiceAudioSourceQueue.ElementAt(i).enabled = enable; } } for (int i = HeroLinesAudioDict.Count - 1; i >= 0; i--) { if (HeroLinesAudioDict.ElementAt(i).Value.enabled != enable) { if (enable) { HeroLinesAudioDict.ElementAt(i).Value.clip = null; } HeroLinesAudioDict.ElementAt(i).Value.enabled = enable; } } if (GameKillAudioSource.enabled != enable) { if (enable) { GameKillAudioSource.clip = null; } GameKillAudioSource.enabled = enable; } if (HeroGetMoneySource.enabled != enable) { if (enable) { HeroGetMoneySource.clip = null; } HeroGetMoneySource.enabled = enable; } if (NGUITools.audioSource != null && NGUITools.audioSource.enabled != enable) { if (enable) { NGUITools.audioSource.clip = null; } NGUITools.audioSource.enabled = enable; } }