当我在框中输入值 990 以使指针指向 970 时,如何修改代码?显示箭头上的模拟值
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class barometer : MonoBehaviour {
public float maxValue = 0.0f;
public float minArrowAngle;
public float maxArrowAngle;
public RectTransform arrow; // The arrow
public float value = 0.0f;
public Text valueLabel;
// Update is called once per frame
void Update () {
if (valueLabel != null)
valueLabel.text = ((int)value) + " hPa";
if (arrow != null)
arrow.localEulerAngles = new Vector3(0, 0, Mathf.Lerp(minArrowAngle, maxArrowAngle, value / maxValue));
}
}