public void SetMix(AnimationReferenceAsset from, AnimationReferenceAsset to, float duration) { // Debug.Log($"[Animation Mix] from name : {from.name}, to name : {to.name}"); skeletonAnimation.AnimationState.Data.SetMix(from.name, to.name, duration); }
이러면 AnimationReferenceAsset으로도 쓸 수 있음
공격 상태 추가하기
스파인에서도 Normalized Time같이 구할 수 있나?
진행도를 계산하는 방법은 있음
var entry = skeletonAnimation.AnimationState.GetCurrent(0);if (entry != null){ float currentTime = entry.TrackTime; // 현재 진행된 시간 (초 단위) float duration = entry.Animation.Duration; // 애니메이션 전체 길이 (초 단위) float normalizedTime = currentTime / duration; // 0 ~ 1 사이의 값 Debug.Log($"진행도: {normalizedTime}");}
이거 한 이유 : 원래는 PlayerAnimator 에서 AttackAnimation()이 이렇게 구성되어 있었음
public void AttackAnimation() { // 공격 모션 끝나면 Idle로 돌아올 수 있도록 함 var entry = skeletonAnimation.AnimationState.SetAnimation(PlayerAnimationKeys.MainAnimationTrack, attack, false); entry.Complete += (trackEntry) => { Player.StateMachine.ChangeState<IdleState>(); };}