Пример #1
0
    public bool PlayWeatherMusic(string audioName, float fadeInTime)
    {
        string eventName   = string.Empty;
        string switchGroup = string.Empty;
        string switchState = string.Empty;

        if (CUnityUtil.IsWwiseAudioName(audioName))
        {
            CUnityUtil.GetWwiseAudioName(audioName, out eventName, out switchGroup, out switchState);
        }
        else
        {
            return(false);
        }

#if false //LOG_WWISE && UNITY_EDITOR
        Common.HobaDebuger.LogWarningFormat("[UnityAudio] Playing [Wwise] Event: {0} SwitchGroup: {1} SwitchState: {2}",
                                            eventName, switchGroup, switchState);
#endif

        if (_WeatherSoundEntry.IsEnabled)
        {
            CheckAudioListener();

            SafeInitGameObject(_WeatherSoundEntry, "weather");

            LoadAndPlayMusic(_WeatherSoundEntry, eventName, switchGroup, switchState);
        }
        return(true);
    }
Пример #2
0
    public string Play2DAudio(string audioName, int sortId = 0, bool isLoop = false)
    {
        if (CUnityUtil.IsWwiseAudioName(audioName))
        {
            return(string.Empty);
        }

        EffectAudioSourceItem item = _PlaySFX(audioName, AudioType.S2D, null, Vector3.zero, sortId, isLoop);

        return(item != null && item.audioSource != null ? item.audioSource.name : string.Empty);
    }
Пример #3
0
    public bool PlayWeatherMusic(string envName, float fadeInTime)
    {
        if (CUnityUtil.IsWwiseAudioName(envName))
        {
            return(false);
        }

        if (_WeatherSoundEntry.IsEnabled)
        {
            CheckAudioListener();

            SafeInitGameObject(_WeatherSoundEntry, "weather");

            LoadAndPlayMusic(_WeatherSoundEntry, envName, fadeInTime);
        }

        return(true);
    }
Пример #4
0
    public bool PlayBackgroundMusic(string bgmName, float fadeInTime)
    {
        if (CUnityUtil.IsWwiseAudioName(bgmName))
        {
            return(false);
        }

        if (_BgmSoundEntry.IsEnabled)
        {
            CheckAudioListener();

            SafeInitGameObject(_BgmSoundEntry, "background");

            LoadAndPlayMusic(_BgmSoundEntry, bgmName, fadeInTime);
        }

        return(true);
    }