IEnumerator ManageLoop(AudioSource source, LoopGroup group, EffectFader fader) { while (true) { fader.Update(Time.deltaTime); source.volume = fader.Value * group.VolumeRange.x; yield return(null); } }
public void PlayClip(LoopGroup group, EffectFader fader) { AudioSource source = Pool.Grab(); source.clip = group.LoopedAudio; source.pitch = group.PitchRange.x; source.volume = group.VolumeRange.x; source.loop = true; source.Play(); StartCoroutine(ManageLoop(source, group, fader)); }
public static void Play(LoopGroup group, EffectFader fader) { instance.PlayClip(group, fader); }