public void playBGM(string bgmName, float volume = 1.0f, float fadeTime = 0.0f) { // destory old BGM if (fadeOutBGMPlayer != null) { fadeOutBGMPlayer.destory(); } // change to fade out for current BGM if (curBGMPlayer != null) { curBGMPlayer.stopBGM(fadeTime); fadeOutBGMPlayer = curBGMPlayer; } // play new BGM if (bgmClips.ContainsKey(bgmName) == false) { reserveBGM(bgmName); // null BGM //curBGMPlayer = new BGMPlayer(); //return false; // not register } curBGMPlayer = new PBGMPlayer(bgmClips[bgmName].resourceName); curBGMPlayer.localVolume = volume; curBGMPlayer.volume = bgmVolume; curBGMPlayer.playBGM(fadeTime); }
public Playing(PBGMPlayer bgmPlayer) : base(bgmPlayer) { if (bgmPlayer.source.isPlaying == false) { bgmPlayer.source.volume = bgmPlayer.baseVolume; bgmPlayer.source.Play(); } }
public void clearBGM() { stopBGM(0.0f); if (curBGMPlayer != null) { curBGMPlayer.destory(); curBGMPlayer = null; } if (fadeOutBGMPlayer != null) { fadeOutBGMPlayer.destory(); fadeOutBGMPlayer = null; } foreach (KeyValuePair <string, AudioClipInfo> pair in bgmClips) { //GameObject.Destroy( pair.Value.clip ); Resources.UnloadAsset(pair.Value.clip); } bgmClips.Clear(); }
public void playBGM( string bgmName, float volume = 1.0f, float fadeTime = 0.0f ) { // destory old BGM if ( fadeOutBGMPlayer != null ) fadeOutBGMPlayer.destory(); // change to fade out for current BGM if ( curBGMPlayer != null ) { curBGMPlayer.stopBGM( fadeTime ); fadeOutBGMPlayer = curBGMPlayer; } // play new BGM if ( bgmClips.ContainsKey( bgmName ) == false ) { reserveBGM(bgmName); // null BGM //curBGMPlayer = new BGMPlayer(); //return false; // not register } curBGMPlayer = new PBGMPlayer( bgmClips[ bgmName ].resourceName ); curBGMPlayer.localVolume = volume; curBGMPlayer.volume = bgmVolume; curBGMPlayer.playBGM( fadeTime ); }
public void clearBGM() { stopBGM(0.0f); if(curBGMPlayer!=null) { curBGMPlayer.destory(); curBGMPlayer = null; } if(fadeOutBGMPlayer!=null) { fadeOutBGMPlayer.destory(); fadeOutBGMPlayer = null; } foreach(KeyValuePair<string, AudioClipInfo> pair in bgmClips) { //GameObject.Destroy( pair.Value.clip ); Resources.UnloadAsset(pair.Value.clip); } bgmClips.Clear(); }
public Wait( PBGMPlayer bgmPlayer ) : base(bgmPlayer) { }
public State( PBGMPlayer bgmPlayer ) { this.bgmPlayer = bgmPlayer; }
public Playing( PBGMPlayer bgmPlayer ) : base(bgmPlayer) { if ( bgmPlayer.source.isPlaying == false ) { bgmPlayer.source.volume = bgmPlayer.baseVolume; bgmPlayer.source.Play(); } }
public Pause( PBGMPlayer bgmPlayer, State preState ) : base(bgmPlayer) { this.preState = preState; bgmPlayer.source.Pause(); }
public FadeOut( PBGMPlayer bgmPlayer ) : base(bgmPlayer) { initVolume = bgmPlayer.source.volume; bgmPlayer.isFinishFadeOut = false; }
public FadeIn( PBGMPlayer bgmPlayer ) : base(bgmPlayer) { bgmPlayer.source.Play(); bgmPlayer.source.volume = 0.0f; }
public FadeOut(PBGMPlayer bgmPlayer) : base(bgmPlayer) { initVolume = bgmPlayer.source.volume; bgmPlayer.isFinishFadeOut = false; }
public Pause(PBGMPlayer bgmPlayer, State preState) : base(bgmPlayer) { this.preState = preState; bgmPlayer.source.Pause(); }
public FadeIn(PBGMPlayer bgmPlayer) : base(bgmPlayer) { bgmPlayer.source.Play(); bgmPlayer.source.volume = 0.0f; }
public Wait(PBGMPlayer bgmPlayer) : base(bgmPlayer) { }
public State(PBGMPlayer bgmPlayer) { this.bgmPlayer = bgmPlayer; }