示例#1
0
    public void PlayPopupMusicIn()
    {
        PopupMusic popup = popupMusics.Find(item => { return(item.popup == GetGamePopup()); });

        if (popup == null)
        {
            Debug.LogError(debugableInterface.debugLabel + "There is no PopuMusic for popup " + GetGamePopup());
            return;
        }

        popup.Play();
    }
示例#2
0
    IEnumerator FadePopupMusic(bool inOut)
    {
        if (!initialized)
        {
            Debug.LogError(debugableInterface.debugLabel + "Not initialized !");
            yield break;
        }

        PanelMusic panel = panelMusics.Find(item => { return(item.phase == GetActualGamePhase()); });
        PopupMusic popup = popupMusics.Find(item => { return(item.popup == GetGamePopup()); });

        if (panel == null || !panel.IsValid())
        {
            Debug.LogError(debugableInterface.debugLabel + "There is no audio source for panel " + GetActualGamePhase());
            yield break;
        }

        FadeMusicOut();

        if (popup == null)
        {
            Debug.LogError(debugableInterface.debugLabel + "There is no PopuMusic for popup " + GetGamePopup());
            yield break;
        }

        float step = inOut ? popup.maxVolume / transitionDuration : -popup.maxVolume / transitionDuration;

        while (inOut?popup.source.volume < popup.maxVolume : popup.source.volume > 0)
        {
            popup.SetVolume(popup.GetVolume() + step);

            yield return(null);
        }

        if (inOut)
        {
            popup.SetVolume(popup.maxVolume);
        }
        else
        {
            popup.Init();
        }

        yield break;
    }