Example #1
0
 /**
  * Stops playing whatever clip is running in the UI.
  */
 public void StopAudioClip()
 {
     audioSource.Stop();
     audioSource.clip = null;
     if (playingAudioInfoElement != null)
     {
         AudioInfoElement element = playingAudioInfoElement;
         playingAudioInfoElement = null;
         element.TurnOff();
     }
 }
Example #2
0
    public void AddAudioCue(Vector3 position, AudioInfoElement audioInfo)
    {
        AudioCueInfo audioCueInfo = new AudioCueInfo();

        audioCueInfo.id       = audioInfo.id;
        audioCueInfo.position = position;
        audioCueInfoList.Add(audioCueInfo);

        GameObject audioCue = CreateAudioCueFromInfo(audioCueInfo);

        audioCueObjList.Add(audioCue);
    }
Example #3
0
 /**
  * Fills a panel with AudioCueElements with info from the library.
  */
 public void PopulateAudioList()
 {
     foreach (Audio audio in audioLibrary.library)
     {
         GameObject       element          = Instantiate(audioInfoElementPrefab);
         AudioInfoElement audioInfoElement = element.GetComponent <AudioInfoElement>();
         audioInfoElement.id      = audio.id;
         audioInfoElement.clip    = audio.clip;
         audioInfoElement.manager = this;
         element.transform.SetParent(audioListContentPanel.transform);
     }
 }
Example #4
0
 /**
  * Plays the given audio clip in the UI.
  */
 public void PlayAudioClip(AudioInfoElement element)
 {
     StopAudioClip();
     if (element.clip != null)
     {
         audioSource.clip = element.clip;
         audioSource.Play();
         playingAudioInfoElement = element;
     }
     else
     {
         Debug.LogWarning("Provided clip was null.");
     }
 }