25 lines
642 B
C#
25 lines
642 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class MuteButton : MonoBehaviour
|
|
{
|
|
public AudioListener audioL;
|
|
private Button thisBtn;
|
|
private Color thisBtnColor;
|
|
private void Awake()
|
|
{
|
|
thisBtn = GetComponent<Button>();
|
|
thisBtnColor = GetComponent<Image>().color;
|
|
thisBtn.onClick.AddListener(MutePlayer);
|
|
}
|
|
|
|
public void MutePlayer()
|
|
{
|
|
SoundPlayer.instance.ToggleMute();
|
|
thisBtnColor.a = SoundPlayer.instance.thisAS.volume == .5f ? 1 : .5f;
|
|
thisBtn.GetComponent<Image>().color = thisBtnColor;
|
|
}
|
|
}
|