campfire/Assets/Scripts/SfxPlayer.cs

18 lines
377 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SfxPlayer : MonoBehaviour {
public AudioSource Source;
public AudioClip[] Clips;
private void Update() {
}
public void Play() {
if (enabled && Clips.Length > 0) {
Source.PlayOneShot(Clips[Random.Range(0, Clips.Length)]);
}
}
}