diff options
Diffstat (limited to 'Client/Assembly-CSharp/DynamicSound.cs')
-rw-r--r-- | Client/Assembly-CSharp/DynamicSound.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/DynamicSound.cs b/Client/Assembly-CSharp/DynamicSound.cs new file mode 100644 index 0000000..f91f63d --- /dev/null +++ b/Client/Assembly-CSharp/DynamicSound.cs @@ -0,0 +1,26 @@ +using System; +using UnityEngine; + +public class DynamicSound : ISoundPlayer +{ + public string Name { get; set; } + + public AudioSource Player { get; set; } + + public DynamicSound.GetDynamicsFunction volumeFunc; + + public delegate void GetDynamicsFunction(AudioSource source, float dt); + + public void Update(float dt) + { + this.volumeFunc(this.Player, dt); + } + + public void SetTarget(AudioClip clip, DynamicSound.GetDynamicsFunction volumeFunc) + { + this.volumeFunc = volumeFunc; + this.Player.clip = clip; + this.volumeFunc(this.Player, 1f); + this.Player.Play(); + } +} |