| 1 | using System.Collections; |
| 2 | using System.Collections.Generic; |
| 3 | using UnityEngine; |
| 4 | |
| 5 | public class SFXSpawner : MonoBehaviour |
| 6 | { |
| 7 | private static SFXSpawner instance; |
| 8 | [SerializeField] private SFXInstance sfxPrefab; |
| 9 | |
| 10 | // Start is called before the first frame update |
| 11 | void Awake() |
| 12 | { |
| 13 | instance = this; |
| 14 | } |
| 15 | |
| 16 | public static void StartSFX(Sounds sound, Vector3 position) |
| 17 | { |
| 18 | SFXInstance sfx = Instantiate(instance.sfxPrefab, position, Quaternion.identity); |
| 19 | sfx.PlayAudio(sound); |
| 20 | } |
| 21 | |
| 22 | public enum Sounds |
| 23 | { |
| 24 | Connect, Disconnect, Click |
| 25 | } |
| 26 | } |