Beispiel #1
0
        public override void OnSingletonInit()
        {
            m_IsSoundEnable = PlayerPrefs.GetInt(SOUND_STATE_RECORD_KEY, 1) > 0;
            m_IsMusicEnable = PlayerPrefs.GetInt(MUSIC_STATE_RECORD_KEY, 1) > 0;

            ObjectPool <AudioUnit> .S.Init(m_MaxCacheSoundCount, 1);

            m_MainUnit           = AudioUnit.Allocate();
            m_MainUnit.usedCache = false;
        }
Beispiel #2
0
        public int PlaySound(string name, bool loop = false, Action <int> callBack = null, int customEventID = -1)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(-1);
            }

            AudioUnit unit = AudioUnit.Allocate();

            unit.SetAudio(gameObject, name, loop, m_IsSoundEnable);
            unit.SetOnFinishListener(callBack);
            unit.customEventID = customEventID;
            return(unit.id);
        }