Exemple #1
0
        public int PlaySound(string name, bool loop = false, Action <int> callBack = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(-1);
            }

            AudioUnit unit = AudioUnit.Allocate();

            if (unit == null)
            {
                return(-1);
            }

            unit.SetAudio(gameObject, name, loop, m_IsSoundEnable);
            unit.SetOnFinishListener(callBack);
            return(unit.id);
        }
Exemple #2
0
 public int PlayBg(string name, bool loop = true, Action <int> callBack = null)
 {
     m_MainUnit.SetAudio(gameObject, name, loop, m_IsMusicEnable);
     m_MainUnit.SetOnFinishListener(callBack);
     return(m_MainUnit.id);
 }