From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- Client/Assembly-CSharp/DynamicSound.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Client/Assembly-CSharp/DynamicSound.cs (limited to 'Client/Assembly-CSharp/DynamicSound.cs') 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(); + } +} -- cgit v1.1-26-g67d0