summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/DynamicSound.cs
blob: f91f63d82e809fc6a06f31cd207854a904aab1fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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();
	}
}