mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
24 lines
669 B
C#
24 lines
669 B
C#
using UnityEngine;
|
|
using Spine.Unity;
|
|
|
|
public class SkeletonGraphicPlayAnimationAtEvent : MonoBehaviour {
|
|
|
|
public SkeletonGraphic skeletonGraphic;
|
|
public int trackIndex = 0;
|
|
public float playbackSpeed = 1.0f;
|
|
|
|
public void PlayAnimationLooping (string animation) {
|
|
var entry = skeletonGraphic.AnimationState.SetAnimation(trackIndex, animation, true);
|
|
entry.TimeScale = playbackSpeed;
|
|
}
|
|
|
|
public void PlayAnimationOnce (string animation) {
|
|
var entry = skeletonGraphic.AnimationState.SetAnimation(trackIndex, animation, false);
|
|
entry.TimeScale = playbackSpeed;
|
|
}
|
|
|
|
public void ClearTrack () {
|
|
skeletonGraphic.AnimationState.ClearTrack(trackIndex);
|
|
}
|
|
}
|