예제 #1
0
    public static void Play(AudioClip clip)
    {
        UIAudioPlayer instance = UIAudioPlayer.Instance;

        if (instance != null && instance.CanPlaySound())
        {
            AudioSource source = UIAudioPlayer.Instance.GetSource();
            if (source == null)
            {
                return;
            }
            source.PlayOneShot(clip);
        }
    }
예제 #2
0
    public static void Play(UIAudioPlayer.UISoundType type)
    {
        if (type >= UIAudioPlayer.UISoundType._Count)
        {
            return;
        }
        UIAudioPlayer instance = UIAudioPlayer.Instance;

        if (instance != null && instance.CanPlaySound())
        {
            AudioClip audioClip = UIAudioPlayer.Instance.m_StandardSounds[(int)type];
            if (audioClip != null)
            {
                AudioSource source = UIAudioPlayer.Instance.GetSource();
                if (source == null)
                {
                    return;
                }
                source.PlayOneShot(audioClip);
            }
        }
    }