NG_/Scripts/UI/环境监测/WenChang.cs

31 lines
688 B
C#
Raw Normal View History

2024-12-13 18:49:44 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class WenChang : MonoBehaviour
{
public Material mat;
private string lastText = "";
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
string nowText = gameObject.GetComponent<Text>().text;
if (nowText!= lastText)
{
lastText = nowText;
float num = float.Parse(nowText);
if (num < -10 && num >= -20)
{
mat.color = new Color(0.55f, 0.7f, 1f, 0.6f);
}
}
}
}