update
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
namespace Unity.FPS.Game
|
||||
{
|
||||
public class AudioManager : MonoBehaviour
|
||||
{
|
||||
public AudioMixer[] AudioMixers;
|
||||
|
||||
public AudioMixerGroup[] FindMatchingGroups(string subPath)
|
||||
{
|
||||
for (int i = 0; i < AudioMixers.Length; i++)
|
||||
{
|
||||
AudioMixerGroup[] results = AudioMixers[i].FindMatchingGroups(subPath);
|
||||
if (results != null && results.Length != 0)
|
||||
{
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetFloat(string name, float value)
|
||||
{
|
||||
for (int i = 0; i < AudioMixers.Length; i++)
|
||||
{
|
||||
if (AudioMixers[i] != null)
|
||||
{
|
||||
AudioMixers[i].SetFloat(name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GetFloat(string name, out float value)
|
||||
{
|
||||
value = 0f;
|
||||
for (int i = 0; i < AudioMixers.Length; i++)
|
||||
{
|
||||
if (AudioMixers[i] != null)
|
||||
{
|
||||
AudioMixers[i].GetFloat(name, out value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user