Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public Playing(PBGMPlayer bgmPlayer) : base(bgmPlayer)
 {
     if (bgmPlayer.source.isPlaying == false)
     {
         bgmPlayer.source.volume = bgmPlayer.baseVolume;
         bgmPlayer.source.Play();
     }
 }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
        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 );
        }
Ejemplo n.º 5
0
 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();
 }
Ejemplo n.º 6
0
 public Wait( PBGMPlayer bgmPlayer )
     : base(bgmPlayer)
 {
 }
Ejemplo n.º 7
0
 public State( PBGMPlayer bgmPlayer )
 {
     this.bgmPlayer = bgmPlayer;
 }
Ejemplo n.º 8
0
 public Playing( PBGMPlayer bgmPlayer )
     : base(bgmPlayer)
 {
     if ( bgmPlayer.source.isPlaying == false ) {
         bgmPlayer.source.volume = bgmPlayer.baseVolume;
         bgmPlayer.source.Play();
     }
 }
Ejemplo n.º 9
0
 public Pause( PBGMPlayer bgmPlayer, State preState )
     : base(bgmPlayer)
 {
     this.preState = preState;
     bgmPlayer.source.Pause();
 }
Ejemplo n.º 10
0
 public FadeOut( PBGMPlayer bgmPlayer )
     : base(bgmPlayer)
 {
     initVolume = bgmPlayer.source.volume;
     bgmPlayer.isFinishFadeOut = false;
 }
Ejemplo n.º 11
0
 public FadeIn( PBGMPlayer bgmPlayer )
     : base(bgmPlayer)
 {
     bgmPlayer.source.Play();
     bgmPlayer.source.volume = 0.0f;
 }
Ejemplo n.º 12
0
 public FadeOut(PBGMPlayer bgmPlayer) : base(bgmPlayer)
 {
     initVolume = bgmPlayer.source.volume;
     bgmPlayer.isFinishFadeOut = false;
 }
Ejemplo n.º 13
0
 public Pause(PBGMPlayer bgmPlayer, State preState) : base(bgmPlayer)
 {
     this.preState = preState;
     bgmPlayer.source.Pause();
 }
Ejemplo n.º 14
0
 public FadeIn(PBGMPlayer bgmPlayer) : base(bgmPlayer)
 {
     bgmPlayer.source.Play();
     bgmPlayer.source.volume = 0.0f;
 }
Ejemplo n.º 15
0
 public Wait(PBGMPlayer bgmPlayer) : base(bgmPlayer)
 {
 }
Ejemplo n.º 16
0
 public State(PBGMPlayer bgmPlayer)
 {
     this.bgmPlayer = bgmPlayer;
 }