43 lines
862 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LoadingPf : MonoBehaviour
{
List<Sprite> sprites;
Image image;
private void Start()
{
sprites = new List<Sprite>();
for (int i = 1; i < 80; i++)
{
sprites.Add(Resources.Load<Sprite>($"Images/全屏loading/loading{i.ToString("0000")}"));
}
image = transform.GetComponent<Image>();
}
int index = 0;
float time = 0;
public void Initial()
{
index = 0;
time = 0;
}
void Update()
{
time += Time.deltaTime;
if (time < 0.03)
{
return;
}
time = 0;
if (index % 79 == 0)
{
index = 0;
}
image.sprite = sprites[index];
index++;
}
}