mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
22 lines
590 B
C#
22 lines
590 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using Spine.Unity;
|
|
|
|
public class SpineBlinkPlayer : MonoBehaviour {
|
|
const int BlinkTrack = 1;
|
|
|
|
[SpineAnimation]
|
|
public string blinkAnimation;
|
|
public float minimumDelay = 0.15f;
|
|
public float maximumDelay = 3f;
|
|
|
|
IEnumerator Start () {
|
|
var skeletonAnimation = GetComponent<SkeletonAnimation>(); if (skeletonAnimation == null) yield break;
|
|
while (true) {
|
|
skeletonAnimation.state.SetAnimation(SpineBlinkPlayer.BlinkTrack, blinkAnimation, false);
|
|
yield return new WaitForSeconds(Random.Range(minimumDelay, maximumDelay));
|
|
}
|
|
}
|
|
|
|
}
|