```csharp
using Sirenix.OdinInspector;
using Spine.Unity;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MixTest1 : MonoBehaviour
{
[SerializeField]
[SpineAnimation]
private string _beforeAnim;
[SerializeField]
[SpineAnimation]
private string _animationName;
//播放通道序号
public int TrackIndex = 1;
public float AttachmentThreshold = 1;
public float MixDuration = 0;
public float mixDuration = 5;
public float delay = 0.1f;
public SkeletonAnimation skeletonAnimation;
[Button("Test0")]
public void Play1()
{
// 默认前面动画在0播放,可自行修改
var track = skeletonAnimation.AnimationState.SetAnimation(0, _beforeAnim, true);
}
[Button("Test1")]
public void PlayShoot()
{
// 叠加动画 在 通道1播放
var track = skeletonAnimation.AnimationState.SetAnimation(TrackIndex, _animationName, false);
track.AttachmentThreshold = AttachmentThreshold;
track.MixDuration = MixDuration;
var empty = skeletonAnimation.state.AddEmptyAnimation(TrackIndex, mixDuration, delay);
empty.AttachmentThreshold = 1f;
}
}
在做动画叠加的时候,部分融化直接的 骨骼冲突导致 某些时候只能A融合B而不能B融合A,所以在制作动画的时候,需要考虑好动画之间的关系,哪些是基础动画,哪些是叠加动画
|