*
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
|
||||
public class AudioMixerController : MonoBehaviour {
|
||||
public AudioMixer ambientMixer;
|
||||
public string snapshotName = "Master";
|
||||
public float transitionTime = 1.0f;
|
||||
private PlayerSensor _sensor;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
_sensor = GetComponentInChildren<PlayerSensor>();
|
||||
_sensor.PlayerEnter += HandlePlayerEnter;
|
||||
}
|
||||
|
||||
void HandlePlayerEnter (PlayerSensor sensor, GameObject player)
|
||||
{
|
||||
var snap = ambientMixer.FindSnapshot(snapshotName);
|
||||
snap.TransitionTo(transitionTime);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user