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 playBGM() { if (curBGMPlayer != null && curBGMPlayer.hadFadeOut() == false) { curBGMPlayer.playBGM(); } if (fadeOutBGMPlayer != null && fadeOutBGMPlayer.hadFadeOut() == false) { fadeOutBGMPlayer.playBGM(); } }
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 ); }