Beispiel #1
0
 public void StopLoopingEffect(AudioSource loopingEffect)
 {
     if (loopingEffect && loopingEffect.isPlaying)
     {
         this.activeLoopingSounds.Remove(loopingEffect);
         AudioVolumeFader component = loopingEffect.gameObject.GetComponent <AudioVolumeFader>();
         if (component && base.gameObject.activeInHierarchy)
         {
             float delay = component.FadeOut();
             base.StartCoroutine(this.DelayedStop(loopingEffect, delay));
         }
         else
         {
             loopingEffect.Stop();
         }
     }
 }
Beispiel #2
0
 private void StartLoopingEffect(AudioSource loopingSource, Transform optionalSoundHost)
 {
     loopingSource.loop = true;
     if (optionalSoundHost)
     {
         loopingSource.transform.parent        = optionalSoundHost;
         loopingSource.transform.localPosition = Vector3.zero;
     }
     if (loopingSource.enabled)
     {
         AudioVolumeFader component = loopingSource.gameObject.GetComponent <AudioVolumeFader>();
         if (component)
         {
             component.FadeIn();
         }
         loopingSource.Play();
     }
     loopingSource.mute = this.audioMuted;
     this.activeLoopingSounds.Add(loopingSource);
 }