campfire/Assets/Scripts/SfxPlayer.cs

18 lines
377 B
C#
Raw Normal View History

2020-05-03 23:09:44 +02:00
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)]);
}
}
}