Mobile-Audio-Test-Suite/Assets/Tests/12.ReverbZoneMix/ReverbZoneMix_controller.cs

53 строки
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(AudioSource))]
public class ReverbZoneMix_controller : MonoBehaviour
{
AudioSource source;
[SerializeField]
Text status;
[SerializeField]
Slider ReverbZoneSlider;
FrameworkController controller;
// Use this for initialization
void Start()
{
controller = FindObjectOfType<FrameworkController>();
source = GetComponent<AudioSource>();
if (controller != null)
{
source.Play();
}
else
{
Debug.Log("Framework controller not found. Are you starting from MainMenu Scene?");
}
ReverbZoneSlider.value = source.reverbZoneMix;
}
// Update is called once per frame
void Update()
{
source.reverbZoneMix = ReverbZoneSlider.value;
status.text = "Reverb Zone Mix: " + source.reverbZoneMix;
}
public void PlayClick()
{
source.Play();
}
public void StopClick()
{
source.Stop();
}
}