Esempio n. 1
0
    /// <summary>
    /// 播放音效
    /// </summary>
    /// <param name="path"></param>
    /// <param name="audioType"></param>
    public static AudioObject PlayAudio(string path, Transform parent, AudioEnunType audioType, float volume = 1, bool loop = false)
    {
        AudioObject audio = default(AudioObject);

        switch (audioType)
        {
        case AudioEnunType.BGM:
            audio = bgmAudio.Play(path, parent, new AudioParamete()
            {
                volume = volume, loop = loop, audio3DValue = 0
            });
            break;

        case AudioEnunType.Effset:
            audio = effectAudio.Play(path, parent, new AudioParamete()
            {
                volume = volume, loop = loop, audio3DValue = 0
            });
            break;

        case AudioEnunType.Speech:
            audio = speechAudio.Play(path, parent, new AudioParamete()
            {
                volume = volume, loop = loop, audio3DValue = 0
            });
            break;

        default:
            break;
        }

        return(audio);
    }
Esempio n. 2
0
    /// <summary>
    /// 停止所有音效
    /// </summary>
    /// <param name="audioType"></param>
    public static void StopAllAudio(AudioEnunType audioType)
    {
        switch (audioType)
        {
        case AudioEnunType.BGM:
            bgmAudio.StopAllAudio();
            break;

        case AudioEnunType.Effset:
            effectAudio.StopAllAudio();
            break;

        case AudioEnunType.Speech:
            speechAudio.StopAllAudio();
            break;

        default:
            break;
        }
    }
Esempio n. 3
0
    /// <summary>
    /// 设置声音大小
    /// </summary>
    /// <param name="audioType"></param>
    /// <param name="volume"></param>
    public static void SetVolume(AudioEnunType audioType, float volume)
    {
        switch (audioType)
        {
        case AudioEnunType.BGM:
            bgmAudio.SetVolume(volume);
            break;

        case AudioEnunType.Effset:
            effectAudio.SetVolume(volume);
            break;

        case AudioEnunType.Speech:
            speechAudio.SetVolume(volume);
            break;

        default:
            break;
        }
    }
Esempio n. 4
0
    /// <summary>
    /// 停止音效
    /// </summary>
    /// <param name="path"></param>
    /// <param name="audioType"></param>
    public static void StopAudio(string path, Transform parent, AudioEnunType audioType)
    {
        switch (audioType)
        {
        case AudioEnunType.BGM:
            bgmAudio.Stop(path, parent);
            break;

        case AudioEnunType.Effset:
            effectAudio.Stop(path, parent);
            break;

        case AudioEnunType.Speech:
            speechAudio.Stop(path, parent);
            break;

        default:
            break;
        }
    }
Esempio n. 5
0
    /// <summary>
    /// 播放音效
    /// </summary>
    /// <param name="path"></param>
    /// <param name="audioType"></param>
    /// <param name="audioModeType"></param>
    public static AudioObject PlayAudio(string path, Transform parent, AudioEnunType audioType, AudioParamete audioData)
    {
        AudioObject audio = default(AudioObject);

        switch (audioType)
        {
        case AudioEnunType.BGM:
            audio = bgmAudio.Play(path, parent, audioData);
            break;

        case AudioEnunType.Effset:
            audio = effectAudio.Play(path, parent, audioData);
            break;

        case AudioEnunType.Speech:
            audio = speechAudio.Play(path, parent, audioData);
            break;

        default:
            break;
        }
        return(audio);
    }