Files
CityOfTheDead.Unity/Assets/Scripts/SoundPlayer.cs
T

22 lines
477 B
C#
Raw Normal View History

2025-05-13 05:05:49 +03:00
using UnityEngine;
using System.Collections;
public class SoundPlayer : MonoBehaviour {
public AudioClip[] sounds;
private AudioSource audioSource;
// Use this for initialization
void Start () {
audioSource = gameObject.GetComponent<AudioSource>();
if (sounds != null && audioSource != null) {
AudioClip sound = sounds[Random.Range(0, sounds.Length - 1)];
audioSource.PlayOneShot(sound);
}
}
// Update is called once per frame
void Update () {
}
}