/// <summary> /// Plays a sound. /// </summary> /// <param name="soundClip"> chosen from our dfefault list of SoundClips. </param> public void PlaySound(SoundClip soundClip) { audioSource.Stop(); audioSource.clip = null; audioSource.clip = Resources.Load <AudioClip>("Sound/" + soundClip.ToString()); audioSource.Play(); }
/// <summary> /// Plays a sound one time. /// </summary> /// <param name="soundClip"> chosen from our dfefault list of SoundClips. </param> public void PlaySoundOnce(SoundClip soundClip) { if (lastSoundPlayed != soundClip) { audioSource.clip = Resources.Load <AudioClip>("Sound/" + soundClip.ToString()); audioSource.Play(); lastSoundPlayed = soundClip; } }
/// <summary> /// Gets the name of the last played sound /// </summary> /// <returns>the name of teh last played sound</returns> public string LastSoundPlayed() { return(lastSoundPlayed.ToString()); }
/// <summary> /// Plays a sound with priority. /// </summary> /// <param name="soundClip"> chosen from our dfefault list of SoundClips. </param> public void PlayPrioritySound(SoundClip soundClip) { priorityAudioSource.Stop(); priorityAudioSource.clip = Resources.Load <AudioClip>("Sound/" + soundClip.ToString()); priorityAudioSource.Play(); }