public void FadeSound(SoundIDs id) { Sound s = FindS(id); if (s.Source.isPlaying && !s.fading) { StartCoroutine(DoFade(s)); } }
private AudioSource FindSound(SoundIDs id) { foreach (var s in sounds) { if (s.Id == id) { return(s.Source); } } return(null); }
private Sound FindS(SoundIDs id) { foreach (var s in sounds) { if (s.Id == id) { return(s); } } return(null); }
public void PlayMusic(SoundIDs id) { foreach (var s in sounds) { if (s.Id == id) { musicSource.clip = s.Clip; musicSource.volume = s.Volume; musicSource.Play(); break; } } }
public void PlaySound(SoundIDs id) { Sound sound = FindS(id); if (sound.fading) { StopCoroutine(DoFade(sound)); sound.Source.Stop(); sound.Source.volume = sound.Volume; } foreach (var s in sounds) { if (s.Id == id) { s.Source.Play(); break; } } }
public void StopSound(SoundIDs id) { FindSound(id).Stop(); }