using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 进度条或者数字递增
/// </summary>
public class BarControll : MonoBehaviour
{
private float currentProgress = 6;
/// <summary>
/// 进度条需要持续的时长
/// </summary>
private float duration = 6f;//这个时间可以任意定义
// Update is called once per frame
void Update()
{
if (transform.GetComponent<ScrollRect>().verticalNormalizedPosition > 0)
{
currentProgress -= Time.deltaTime;
transform.GetComponent<ScrollRect>().verticalNormalizedPosition = currentProgress / duration;
if (currentProgress <= 0)
{
transform.GetComponent<ScrollRect>().verticalNormalizedPosition = 1;
currentProgress = 6;
}
}
}
}