Exemplo n.º 1
0
 public void FadeOut(float _time, Interpolate.EaseType _ease)
 {
     if (currentSound != null)
     {
         currentSound.FadeOut(_time, _ease);
     }
 }
    public void FadeTo(SoundClip clip, float time, Interpolate.EaseType ease)
    {
        if (currentPlayingType == MusicPlayingType.None)
        {
            FadeIn(clip, time, ease);
        }
        else if (this.IsDifferentSound(clip))
        {
            if (currentPlayingType == MusicPlayingType.AtoB)
            {
                fadeA_audio.Stop();
                currentPlayingType = MusicPlayingType.SourceB;
            }
            else if (currentPlayingType == MusicPlayingType.BtoA)
            {
                fadeB_audio.Stop();
                currentPlayingType = MusicPlayingType.SourceA;
            }

            lastSound    = currentSound;
            currentSound = clip;
            lastSound.FadeOut(time, ease);
            currentSound.FadeIn(time, ease);


            //FadeTo A->B, B->A 사운드 교체
            if (currentPlayingType == MusicPlayingType.SourceA)
            {
                PlayAudioSource(fadeB_audio, currentSound, 0.0f);
                currentPlayingType = MusicPlayingType.AtoB;
            }
            else if (currentPlayingType == MusicPlayingType.SourceB)
            {
                PlayAudioSource(fadeA_audio, currentSound, 0.0f);
                currentPlayingType = MusicPlayingType.BtoA;
            }

            if (currentSound.HasLoop())
            {
                isTicking = true;
                DoCheck();
            }
        }
    }
Exemplo n.º 3
0
    public void FadeTo(SoundClip _clip, float _time, Interpolate.EaseType _ease)
    {
        if (currentPlayingType == MusicPlayingType.None)
        {
            FadeIn(_clip, _time, _ease);
        }
        else if (IsDifferentSound(_clip) == true)
        {
            if (currentPlayingType == MusicPlayingType.AtoB)
            {
                fadeA_audio.Stop();
                currentPlayingType = MusicPlayingType.SourceB;
            }
            else if (currentPlayingType == MusicPlayingType.BtoA)
            {
                fadeB_audio.Stop();
                currentPlayingType = MusicPlayingType.SourceA;
            }

            //fade to
            lastSound    = currentSound;
            currentSound = _clip;
            lastSound.FadeOut(_time, _ease);
            currentSound.FadeIn(_time, _ease);
            if (currentPlayingType == MusicPlayingType.SourceA)
            {
                PlayAudioSource(fadeB_audio, currentSound, 0.0f);
                currentPlayingType = MusicPlayingType.AtoB;
            }
            else if (currentPlayingType == MusicPlayingType.SourceB)
            {
                PlayAudioSource(fadeA_audio, currentSound, 0.0f);
                currentPlayingType = MusicPlayingType.BtoA;
            }
            if (currentSound.HasLoop())
            {
                isTicking = true;
                DoCheck();
            }
        }
    }