TouhouLS/Assets/RealCode/Animations/SimpleAnimationLoop.cs
LadyEbony d45841455b If a placement won't create a combo, you can now play instantly
Improved character animations to play during loss/win, and to reset during a rematch
Drop tiles won't be rendered if 0
2020-08-22 16:43:30 -07:00

21 lines
467 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SimpleAnimationLoop : MonoBehaviour {
private new SpriteRenderer renderer;
public Sprite[] sprites;
public float frameTime = 0.75f;
private void Awake() {
renderer = GetComponent<SpriteRenderer>();
}
public void Update() {
var frameindex = Mathf.FloorToInt(Time.time / frameTime);
renderer.sprite = sprites[frameindex % sprites.Length];
}
}