Esempio n. 1
0
 /// <summary>
 /// One parameter constructor which copies another AudioClipInfo.
 /// </summary>
 /// <param name="audioClipInfo">The AudioClipInfo that should be copied.</param>
 public AudioClipInfo(AudioClipInfo audioClipInfo)
 {
     m_ClipIndex     = audioClipInfo.m_ClipIndex;
     m_AudioClip     = audioClipInfo.m_AudioClip;
     m_AudioConfig   = audioClipInfo.m_AudioConfig;
     m_AudioModifier = audioClipInfo.m_AudioModifier;
 }
Esempio n. 2
0
        /// <summary>
        /// Plays the audio clip with a random set index.
        /// </summary>
        /// <param name="gameObject">The GameObject that is playing the audio clip.</param>
        /// <param name="audioModifier">The AudioModifier that should override the AudioSource settings.</param>
        /// <param name="clipIndex">The index of the AudioClip that should be played.</param>
        /// <returns>The result of playing the AudioClip.</returns>
        public PlayResult PlayAudioClip(GameObject gameObject, AudioModifier audioModifier, int clipIndex = -1)
        {
            var audioClipInfo = GetAudioClipInfo(clipIndex);

            audioClipInfo    = new AudioClipInfo(audioClipInfo, audioModifier);
            m_LastPlayResult = AudioManager.Play(gameObject, audioClipInfo);
            return(m_LastPlayResult);
        }
Esempio n. 3
0
 /// <summary>
 /// Internal method which plays the audio clip.
 /// </summary>
 /// <param name="playGameObject">The GameObject that should play the AudioClip.</param>
 /// <param name="clipInfo">The AudioClip and AudioConfig used to play the audio.</param>
 /// <returns>The result of playing the AudioClip.</returns>
 protected virtual PlayResult PlayInternal(GameObject playGameObject, AudioClipInfo clipInfo)
 {
     if (playGameObject == null)
     {
         playGameObject = m_GameObject;
     }
     return(m_AudioManagerModule.PlayAudio(playGameObject, clipInfo));
 }
Esempio n. 4
0
 /// <summary>
 /// Stops playing the audio on the specified GameObject.
 /// </summary>
 /// <param name="gameObject">The GameObject to stop the audio on.</param>
 /// <param name="audioClipInfo">The AudioClipInfo that should be stopped.</param>
 public void Stop(GameObject gameObject, AudioClipInfo audioClipInfo)
 {
     AudioManager.Stop(gameObject, audioClipInfo.AudioConfig);
 }
Esempio n. 5
0
 /// <summary>
 /// Internal method which plays the audio clip at the specified position on the specified GameObject.
 /// </summary>
 /// <param name="playGameObject">The GameObject that shoud play the clip.</param>
 /// <param name="clipInfo">The AudioClip and config that should be played.</param>
 /// <param name="position">The position that the clip should be played at.</param>
 /// <returns>The result of playing the AudioClip.</returns>
 protected virtual PlayResult PlayAtPositionInternal(GameObject playGameObject, AudioClipInfo clipInfo, Vector3 position)
 {
     if (playGameObject == null)
     {
         playGameObject = m_GameObject;
     }
     return(m_AudioManagerModule.PlayAtPosition(playGameObject, clipInfo, position));
 }
Esempio n. 6
0
 /// <summary>
 /// Plays the audio clip.
 /// </summary>
 /// <param name="gameObject">The GameObject that shoud play the AudioClip.</param>
 /// <param name="clipInfo">The AudioClip and AudioConfig used to play the audio.</param>
 /// <returns>The result of playing the AudioClip.</returns>
 public static PlayResult Play(GameObject gameObject, AudioClipInfo clipInfo)
 {
     return(Instance.PlayInternal(gameObject, clipInfo));
 }
Esempio n. 7
0
 /// <summary>
 /// Two parameter constructor.
 /// </summary>
 /// <param name="audioSource">The AudioSource that played the AudioClip.</param>
 /// <param name="audioClipInfo">The config used to play the AudioClip.</param>
 public PlayResult(AudioSource audioSource, AudioClipInfo audioClipInfo)
 {
     m_AudioSource   = audioSource;
     m_AudioClipInfo = audioClipInfo;
 }