NG_/Assets/Data Visualization Resources/Scripts/SimpleProgress1.cs

38 lines
563 B
C#
Raw Normal View History

2024-12-13 19:40:05 +08:00

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SimpleProgress1 : MonoBehaviour
{
public bool b = true;
public Image image;
public float speed;
float time = 0f;
public void Start()
{
image = GetComponent<Image>();
}
void Update()
{
if (b)
{
time += Time.deltaTime * speed;
image.fillAmount = time;
if (time > 1)
{
time = 0;
}
}
}
}