9 [Serializable]
public sealed
class AudioClipSet : Set<AudioClip> {
10 [SerializeField, Header(
"Audio")]
private Range volume =
new Range(1, 1);
11 [SerializeField, RangeBounds(0, 2)]
private Range pitch =
new Range(1, 2);
12 [SerializeField, RangeBounds(0, 999)]
private Range distance =
new Range(1, 999);
15 public void Play(
UnityEngine.GameObject gameObject) => Play(gameObject.GetComponent<AudioSource>());
18 public void Play(AudioSource source) {
20 source.pitch = pitch.Pick();
21 source.volume = volume.Pick();
22 source.minDistance = distance.Min;
23 source.maxDistance = distance.Max;
29 [CreateAssetMenu(menuName =
"Custom Assets/Constant/Audio Clips", fileName =
"AudioClips")]
32 public new static AudioClips Instance(
string name) => Instance<AudioClips>(name);
Support class for audio clip playing
void Play(AudioSource source)
Play a random, exhaustive random or sequential sound - with random variations of volume, pitch and distance heard
Base class for a custom asset. Provides getters and setters for the contained value and templates for...