quakeball/Assets/Scripts/Audio/ImpactSound.cs

20 lines
505 B
C#
Raw Normal View History

2020-08-10 19:35:54 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace NeonTea.Quakeball.Audio {
public class ImpactSound : MonoBehaviour {
public AudioSource Source;
public AudioClip[] Clips;
public void PlayAt(Vector3 position) {
transform.position = position;
Source.PlayOneShot(GetRandomClip());
}
private AudioClip GetRandomClip() {
return Clips[Random.Range(0, Clips.Length)];
}
}
}