48 lines
1.0 KiB
C#
48 lines
1.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Assets.Scenes.Ride.Scripts
|
|
{
|
|
public class SpirteRenderScript:MonoBehaviour
|
|
{
|
|
List<Sprite> sprites;
|
|
Image image;
|
|
|
|
private void Start()
|
|
{
|
|
sprites = new List<Sprite>();
|
|
for (int i = 1; i < 61; i++)
|
|
{
|
|
sprites.Add(Resources.Load<Sprite>($"Images/Ride/wave/wave{i.ToString("0000")}"));
|
|
}
|
|
image = transform.GetComponent<Image>();
|
|
|
|
}
|
|
|
|
int index = 0;
|
|
float time = 0;
|
|
float totaltime = 0;
|
|
void Update()
|
|
{
|
|
time += Time.deltaTime;
|
|
totaltime += Time.deltaTime;
|
|
if (time < 0.03)
|
|
{
|
|
return;
|
|
}
|
|
time = 0;
|
|
|
|
image.sprite = sprites[index];
|
|
index++;
|
|
|
|
if (index % 59 == 0)
|
|
{
|
|
index = 0;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|