using System.Collections.Generic; using UnityEngine; using Utils; using Utils.Utils; public class AudioManager : Singleton { private AudioSource audioSource; [SerializeField] private List> clips = new List>(); [SerializeField] private List speech = new List(); private // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { audioSource = GetComponent(); audioSource.pitch = 1; } public void PlaySound(string type) { audioSource.pitch = 1f; audioSource.PlayOneShot(clips.ByKey(type)); } public void PlaySpeechSound(bool pitchDown) { int index = Random.Range(0, speech.Count); audioSource.pitch = pitchDown ? 0.5f:1f; audioSource.PlayOneShot(speech[index], 1.5f); } }