all repos — RPG @ d7044262357209ad359fad4b2664315aea7096d0

Fully functional 3D turn based role playing game coded in C# and base Unity.

Assets/Scripts/Utility/AudioManager.cs (view raw)

 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5[RequireComponent(typeof(AudioSource))]
 6public class AudioManager : MonoBehaviour
 7{
 8    [SerializeField] private AudioClip[] buttonSounds = null;
 9    private AudioSource audioSource;
10
11    public void playButtonSound(int index) {
12        if(index <= buttonSounds.Length)
13            audioSource.PlayOneShot(buttonSounds[index]);
14    }
15    
16    // Start is called before the first frame update
17    void Start()
18    {
19        audioSource = GetComponent<AudioSource>();
20    }
21
22    // Update is called once per frame
23    void Update()
24    {
25        
26    }
27}