public AudioClip GetAudio(ClipID id) { foreach (ClipRef reference in allAudios) { if (reference.id == id) { return(reference.clip); } } Debug.Log("SoundManager error: Could not find a ClipRef with that Id."); return(null); }
public void PlaySound(ClipID id) { if (!primarySFXSound.isPlaying) { primarySFXSound.clip = GetAudio(id); primarySFXSound.Play(); } else { if (!secondarySFXSound.isPlaying) { secondarySFXSound.clip = GetAudio(id); secondarySFXSound.Play(); } } }
public void PlayBGSound(ClipID id) { BGsound.clip = GetAudio(id); BGsound.Play(); BGsound.loop = true; }