2025-05-09 10:20:30 +08:00

46 lines
781 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class OilGauge1 : MonoBehaviour
{
public bool b = true;
public Image image;
public float speed = 0.5f;
float time = 0f;
public Text progress;
public Transform oilOilGaugePivot;
void Update()
{
if (b)
{
time += Time.deltaTime * speed;
image.fillAmount = time;
oilOilGaugePivot.localEulerAngles = Vector3.forward*(90- 180 * image.fillAmount);
if (progress)
{
progress.text = ((int)(image.fillAmount * 100)).ToString();
}
if (time > 1)
{
time = 0;
}
}
}
}