Super Knight : Enter the Dungeon
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using UnityEngine;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using Spine.Unity;
|
|
|
|
|
|
|
|
|
|
public class SpineAnimationBehavior : StateMachineBehaviour
|
|
|
|
|
{
|
|
|
|
|
public AnimationClip clip;
|
|
|
|
|
public string nameClip;
|
|
|
|
|
public int layer = 0;
|
|
|
|
|
public bool LOOP = false;
|
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
nameClip = clip.name;
|
|
|
|
|
LOOP = clip.isLooping;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//for playing the anim at a different timescale if desired
|
|
|
|
|
public float timeScale = 1f;
|
|
|
|
|
|
|
|
|
|
private SkeletonAnimation skeletonAnimation;
|
|
|
|
|
private Spine.AnimationState spineAnimationState;
|
|
|
|
|
private Spine.TrackEntry trackEntry;
|
|
|
|
|
|
|
|
|
|
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
|
|
|
|
{
|
|
|
|
|
if (skeletonAnimation == null)
|
|
|
|
|
{
|
|
|
|
|
skeletonAnimation = animator.GetComponentInChildren<SkeletonAnimation>();
|
|
|
|
|
spineAnimationState = skeletonAnimation.state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trackEntry = spineAnimationState.SetAnimation(layer, nameClip, LOOP);
|
|
|
|
|
trackEntry.TimeScale = timeScale;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// // 스테이트 종료시 발생할것 없다면 지워도되는부분
|
|
|
|
|
// override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
|
|
|
|
// {
|
|
|
|
|
// if(layer == 2)
|
|
|
|
|
// {
|
|
|
|
|
// //spineAnimationState.ClearTrack(layer);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|