Ejemplo n.º 1
0
        public void Play(AudioAsset asset, object context)
        {
#if UNITY_EDITOR // for debugging purposes
            _GameObject.transform.SetAsFirstSibling();
#endif
            _GameObject.SetActive(true);
            Context = context;

            AudioSysUtil.ConfigureAudioSource(_AudioSource, asset);
            _AudioSource.Play();
        }
Ejemplo n.º 2
0
        public void Play(AudioAsset asset, AudioEvent audioEvent)
        {
            IsFree = false;

            if (audioEvent.FollowTransform)
            {
                _TransformFollower.StartFollowing(audioEvent.FollowTransform);
            }
            _GameObject.transform.position = audioEvent.WorldPosition;

            _Callbacks.OnUpdate -= Update;
            _Callbacks.OnUpdate += Update;

            _GameObject.SetActive(true);
            Context = audioEvent.Context;
            AudioSysUtil.ConfigureAudioSource(_AudioSource, asset);
            _AudioSource.Play();
            _GameObject.name = $"Audio Channel {_ChannelNumber}: {audioEvent.Identifier}";
        }