using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using UnityEngine; public class PlaySoundAnimation : MonoBehaviour { [SerializeField] private Sound[] sfx; public void PlaySound(string name) { Sound s = SearchSound(name); if (s != null) { AudioManager.Instance.Play(s.source, s.clip); } else { Debug.LogError($"Sound Not Found with the name: {name}"); } } private Sound SearchSound(string name) => Array.Find(sfx, sound => sound.name == name); }