/// <summary> /// Plaies the background. /// </summary> /// <returns>The background.</returns> /// <param name="clip">Clip.</param> public void PlayBGM( AudioClip clip , bool useFade = false ) { if(!GameData.s_bBMG) return; if(this.m_cBGM == null ) { this.m_cBGM = (new GameObject("BGM")).AddComponent<AudioPlayer>(); this.m_cBGM.transform.parent = this.transform; } if( this.m_cBGM.audio.clip == clip ) return; if(useFade) { StartCoroutine(Fadeout(FASE_OUT_TIME , this.m_cBGM.audio , () =>{ this.m_cBGM.Stop(); this.m_cBGM.Init(clip); this.m_cBGM.Play(MUTE,BGM_VOLUME , true); } )); } else { this.m_cBGM.Stop(); this.m_cBGM.Init(clip); this.m_cBGM.Play(MUTE , BGM_VOLUME , true); } }
/// <summary> /// Stops the ENV. /// </summary> /// <param name="ap">Ap.</param> public void StopENV( AudioPlayer ap ) { ap.Stop(); ap.audio.clip = null; this.m_lstEnableENV.Remove(ap); this.m_seqCache.Enqueue(ap); }
/// <summary> /// Raises the destroy event. /// </summary> void OnDestroy() { if( s_cInstance == this ) { s_cInstance = null; this.m_cBGM = null; this.m_lstEnableSE.Clear(); this.m_lstEnableENV.Clear(); } }
/// <summary> /// Removes the ES. /// </summary> /// <param name="ap">Ap.</param> public void RemoveAudioPlayer( AudioPlayer ap ) { this.m_lstEnableSE.Remove(ap); this.m_lstEnableENV.Remove(ap); ap.audio.clip = null; this.m_seqCache.Enqueue(ap); }