25 lines
513 B
C#
25 lines
513 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class PrecipitationToggle : MonoBehaviour
|
|
{
|
|
private Toggle toggle;
|
|
|
|
public Text text;
|
|
|
|
private void OnEnable()
|
|
{
|
|
toggle = GetComponent<Toggle>();
|
|
UpdateValue();
|
|
}
|
|
|
|
public void UpdateValue()
|
|
{
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
GlobalSettings.Instance.weatherSettings.precipitation = (toggle.isOn ? 1 : 0);
|
|
}
|
|
text.color = new Color(text.color.r, text.color.g, text.color.b, (!toggle.interactable) ? toggle.colors.disabledColor.a : 1f);
|
|
}
|
|
}
|