HKI Core
SoundClip.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using HKI.Core.Variables;
3 
4 namespace HKI.Core.Audio
5 {
9  [System.Serializable]
10  [CreateAssetMenu(fileName = "SoundClip", menuName = "HKI/Audio/SoundClip", order = 1)]
11  public class SoundClip : ScriptableObject
12  {
13  // Public Variables
14  [SerializeField] AudioClip Clip = null;
15  [SerializeField] [Range(0.0f, 1.0f)] float Volume = 1.0f;
16  [SerializeField] [MinMaxRange(0.0f, 3.0f)] MinMaxRange Pitch = new MinMaxRange(1.0f, 1.0f);
17 
18  int clipId = 0;
19 
20  // Getter
21  public AudioClip GetClip { get { return Clip; } }
22  public float GetVolume { get { return Volume; } }
23  public MinMaxRange GetPitch { get { return Pitch; } }
24  public int ClipId { get { return clipId; } }
25 
26  // OnEnable function
27  void OnEnable()
28  {
29  clipId = GetInstanceID();
30  }
31  }
32 }
This is a container ScriptableObject that holds all data required to play a AudioClip.
Definition: SoundClip.cs:11
This is a data type that combines a float start and a float end value into one value. This can be used for storing min max informations for a random generator or volume settings.
Definition: MinMaxRange.cs:9