Exemplo n.º 1
0
 protected override void Awake()
 {
     base.Awake();
     if (primaryFader == null)
     {
         primaryFader = new AudioFader();
     }
     else
     {
         primaryFader.Set0();
     }
     if (secondaryFader == null)
     {
         secondaryFader = new AudioFader();
     }
     else
     {
         secondaryFader.Set0();
     }
     if (audioSource1 == null)
     {
         var components = GetComponents <AudioSource>();
         if (components.Length == 0)
         {
             Debug.LogError("AudioObject does not have an AudioSource component!");
         }
         else
         {
             audioSource1 = components[0];
             if (components.Length >= 2)
             {
                 audioSource2 = components[1];
             }
         }
     }
     else if ((bool)audioSource2 && areSources1And2Swapped)
     {
         SwitchAudioSources();
     }
     audioMixerGroup = PrimaryAudioSource.outputAudioMixerGroup;
     _Set0();
     audioController = AudioController.Instance;
 }
Exemplo n.º 2
0
 public void FadeOut(float fadeOutLength, float startToFadeTime = 0.0f)
 {
     UpdateFadeTime();
     AudioFader.FadeOut(fadeOutLength, startToFadeTime);
 }
Exemplo n.º 3
0
 public void FadeIn(float fadeInTime, bool stopCurrentFadeOut = true)
 {
     UpdateFadeTime();
     AudioFader.FadeIn(fadeInTime, stopCurrentFadeOut);
 }