public void PlaySFX(Inventory.Sound sound) { AudioClip clip = GetSoundClip(sound); if (clip != null) { audioSource.clip = clip; audioSource.Play(); } }
private AudioClip GetSoundClip(Inventory.Sound sound) { switch (sound) { case Inventory.Sound.StartDrag: return(startDragSound); case Inventory.Sound.Drop: return(dropSound); case Inventory.Sound.Cancelled: return(cancelDragSound); default: throw new UnityException("No sound clip for " + sound); } }