void SetAudioSourceToInfoSettings(AudioSource source, AmbienceInfo info) { source.clip = info.audio; source.volume = info.volume; source.loop = info.loop; if (info.mixer != null) { source.outputAudioMixerGroup = info.mixer; } }
public void StopAmbient(AMBIENCES sound) { AmbienceInfo s = ambiences[sound]; for (int i = 0; i < audiosources.Count; i++) { if (audiosources[i].clip == s.audio) { audiosources[i].Stop(); } } }
public void PlayAmbient(AMBIENCES sound) { AmbienceInfo s = ambiences[sound]; if (audiosources[poolidx].isPlaying) { FindNextUnusedSource(); } SetAudioSourceToInfoSettings(audiosources[poolidx], s); audiosources[poolidx].Play(); }