Exemplo n.º 1
0
        /// <summary>
        /// Creates a one shot sound that will follow target transform
        /// </summary>
        /// <param name="clip">The audio clip</param>
        /// <param name="targetTransform">The transform</param>
        /// <param name="vol">The volume</param>
        public virtual void CreateOneShotFollowTarget(AudioClip clip, Transform targetTransform, float vol)
        {
            _plauAudioAndDisable = GetOneShotObject();

            if (_plauAudioAndDisable == null)
            {
                Debug.LogWarning("No component source was found...");
                return;
            }

            //Add it to list in order to properly pause the game
            _plauAudioAndDisable.gameObject.SetActive(true);

            _plauAudioAndDisable.PlayAndDisable(clip, vol, targetTransform);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a one shot sound that will be stationary
        /// </summary>
        /// <param name="clip"></param>
        /// <param name="pos"></param>
        /// <param name="vol"></param>
        public virtual void CreateOneShot(AudioClip clip, Vector3 pos, float vol = 1f)
        {
            _plauAudioAndDisable = GetOneShotObject();

            if (_plauAudioAndDisable == null)
            {
                Debug.LogWarning("No component source was found...");
                return;
            }

            _plauAudioAndDisable.transform.position = pos;

            //Add it to list in order to properly pause the game
            _plauAudioAndDisable.gameObject.SetActive(true);
            _plauAudioAndDisable.PlayAndDisable(clip, vol);
        }