Beispiel #1
0
        /// <summary>
        /// Stop sound, first search key in mixed group, if found, handle sound and remove from mixed group and enqueue ready queue
        /// </summary>
        /// <param name="_name"></param>
        /// <param name="_during"></param>
        /// <param name="_delay"></param>
        public void StopSound(string _name, float _during = DAudio.NO_DURING, float _delay = DAudio.NO_DELAY)
        {
            // if in mixed group, handle audio in mixed group
            DAudio _dAudio = FindSoundInMixedGroup(_name);

            if (_dAudio == null)
            {
#if DINO_DEBUG
                DScreemLogger.Instance.LogToScreen("the name " + _name + "is not currently playing");
#endif
                return;
            }

            _dAudio.ExcuteOperation(DAudio.MIN_VOLUME, _during, _delay, false);
        }
Beispiel #2
0
        /// <summary>
        /// Play sound, first search key in mixed group, if not found, dequeue from ready queue
        /// </summary>
        /// <param name="_name"></param>
        /// <param name="_volume"></param>
        /// <param name="_during"></param>
        /// <param name="_delay"></param>
        public void PlaySound(string _name, float _volume = DAudio.MAX_VOLUME, float _during = DAudio.NO_DURING, float _delay = DAudio.NO_DELAY)
        {
            // if in mixed group, handle audio in mixed group
            DAudio _dAudio = FindSoundInMixedGroup(_name);

            if (_dAudio == null)
            {
                _dAudio = _readyQueue.Dequeue();
            }

            if (_dAudio == null)
            {
#if DINO_DEBUG
                DScreemLogger.Instance.LogToScreen("there is no AudioSource Availible");
#endif
                return;
            }

            _dAudio.ExcuteOperation(_volume, _during, _delay);
        }
Beispiel #3
0
        /// <summary>
        /// init ready queue
        /// </summary>
        protected void InitReadyQueue()
        {
            if (_readyQueue != null)
            {
                _readyQueue.Clear();
            }
            else
            {
                _readyQueue = new Queue <DAudio>();
            }

            for (int i = 0; i < MAX_AUDIOSOURCES_COUNT; i++)
            {
                GameObject _obj = new GameObject("DAudioMixer-" + (i + 1));

                _obj.transform.SetParent(_root);
                _obj.transform.position = Vector3.zero;
                _obj.transform.rotation = Quaternion.identity;

                _readyQueue.Enqueue(DAudio.CreateAudio(_obj.AddComponent <AudioSource>()));
            }
        }