Cute_demon_attacks/meng_yao/Assets/communal/UI/SpriteAniation.cs

48 lines
1007 B
C#
Raw Normal View History

2024-11-13 17:59:42 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//one sprites
2024-11-13 17:59:42 +08:00
public class SpriteAniation : MonoBehaviour
{
[Header("֡<><D6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ")]
public List<Sprite> sprites=new List<Sprite>();
[Header("<22><><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD><EFBFBD><EFBFBD>image")]
public Image image;
[Header("֡ʱ<D6A1><CAB1>,<2C><>λ<EFBFBD><CEBB><EFBFBD>룬Ĭ<EBA3AC><C4AC>100")]
public float Aintime=100f;
private int index=0;
// Start is called before the first frame update
void Start()
{
if (image==null)
{
Debug.LogError("image is null");
}
if (sprites.Count==0)
{
Debug.LogError("sprites is not");
}
InvokeRepeating("ainstart",0f,(Aintime / 1000));
}
void ainstart()
{
image.overrideSprite = sprites[index];
index++;
if (index> sprites.Count-1)
{
index = 0;
}
}
private void OnDestroy()
{
sprites = null;
}
}