Edit Page
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 22: | Line 22: | ||
{ |
{ |
||
− | + | public class AnimEngine_Spine : AnimEngine |
|
{ |
{ |
||
#if UNITY_EDITOR |
#if UNITY_EDITOR |
||
Line 38: | Line 38: | ||
updateHeadAlways = true; |
updateHeadAlways = true; |
||
} |
} |
||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | + | public override PlayerData SavePlayerData (PlayerData playerData, Player player) |
|
{ |
{ |
||
playerData.playerIdleAnim = player.idleAnimSprite; |
playerData.playerIdleAnim = player.idleAnimSprite; |
||
Line 78: | Line 78: | ||
npc.runAnimSprite = npcData.runAnim; |
npc.runAnimSprite = npcData.runAnim; |
||
} |
} |
||
− | |||
#if UNITY_EDITOR |
#if UNITY_EDITOR |
||
Line 564: | Line 563: | ||
{ |
{ |
||
SkeletonAnimation skeletonAnimation = action.runtimeAnim2D.GetComponent<SkeletonAnimation> (); |
SkeletonAnimation skeletonAnimation = action.runtimeAnim2D.GetComponent<SkeletonAnimation> (); |
||
− | + | SetAnimation (action.clip2D, (action.wrapMode2D == ActionAnim.WrapMode2D.Loop), skeletonAnimation, action.layerInt); |
|
− | { |
||
⚫ | |||
− | } |
||
− | else |
||
− | { |
||
− | SkeletonGraphic skeletonGraphic = action.runtimeAnim2D.GetComponent<SkeletonGraphic> (); |
||
− | if (skeletonGraphic) |
||
− | { |
||
− | SetAnimation (action.clip2D, action.wrapMode2D == ActionAnim.WrapMode2D.Loop, skeletonGraphic, action.layerInt); |
||
− | } |
||
− | else |
||
− | { |
||
− | return 0f; |
||
− | } |
||
− | } |
||
if (action.wrapMode2D != ActionAnim.WrapMode2D.Loop && action.willWait) |
if (action.wrapMode2D != ActionAnim.WrapMode2D.Loop && action.willWait) |
||
Line 621: | Line 605: | ||
{ |
{ |
||
SkeletonAnimation skeletonAnimation = action.runtimeAnim2D.GetComponent<SkeletonAnimation> (); |
SkeletonAnimation skeletonAnimation = action.runtimeAnim2D.GetComponent<SkeletonAnimation> (); |
||
⚫ | |||
− | if (skeletonAnimation) |
||
− | { |
||
− | SetAnimation (action.clip2D, action.wrapMode2D == ActionAnim.WrapMode2D.Loop, skeletonAnimation, action.layerInt); |
||
− | } |
||
− | else |
||
− | { |
||
− | SkeletonGraphic skeletonGraphic = action.runtimeAnim2D.GetComponent<SkeletonGraphic> (); |
||
− | if (skeletonGraphic) |
||
− | { |
||
− | SetAnimation (action.clip2D, action.wrapMode2D == ActionAnim.WrapMode2D.Loop, skeletonGraphic, action.layerInt); |
||
− | } |
||
− | } |
||
} |
} |
||
} |
} |
||
Line 647: | Line 620: | ||
if (trackEntry != null) |
if (trackEntry != null) |
||
{ |
{ |
||
− | if (trackEntry.Animation.Name == clip |
+ | if (trackEntry.Animation.Name == clip) |
{ |
{ |
||
return; |
return; |
||
Line 654: | Line 627: | ||
skeletonAnimation.state.SetAnimation (trackIndex, clip, doLoop); |
skeletonAnimation.state.SetAnimation (trackIndex, clip, doLoop); |
||
⚫ | |||
− | |||
− | |||
− | private void SetAnimation (string clip, bool doLoop, SkeletonGraphic skeletonGraphic, int trackIndex) |
||
⚫ | |||
− | if (string.IsNullOrEmpty (clip) || skeletonGraphic == null) |
||
− | { |
||
− | return; |
||
− | } |
||
− | |||
− | TrackEntry trackEntry = skeletonGraphic.AnimationState.GetCurrent (trackIndex); |
||
− | if (trackEntry != null) |
||
− | { |
||
− | if (trackEntry.Animation.Name == clip && trackEntry.Loop == doLoop) |
||
− | { |
||
− | return; |
||
− | } |
||
− | } |
||
− | |||
− | skeletonGraphic.AnimationState.SetAnimation (trackIndex, clip, doLoop); |
||
} |
} |
||
Line 960: | Line 913: | ||
{ |
{ |
||
− | + | public class CompletionListener : MonoBehaviour |
|
{ |
{ |
||
Line 967: | Line 920: | ||
private string waitingAnimation; |
private string waitingAnimation; |
||
private SkeletonAnimation skeletonAnimation; |
private SkeletonAnimation skeletonAnimation; |
||
− | private SkeletonGraphic skeletonGraphic; |
||
#endregion |
#endregion |
||
Line 985: | Line 937: | ||
{ |
{ |
||
skeletonAnimation = GetComponent<SkeletonAnimation> (); |
skeletonAnimation = GetComponent<SkeletonAnimation> (); |
||
− | } |
||
− | |||
− | if (skeletonAnimation == null && skeletonGraphic == null) |
||
− | { |
||
− | skeletonGraphic = GetComponent<SkeletonGraphic> (); |
||
} |
} |
||
Line 995: | Line 942: | ||
{ |
{ |
||
skeletonAnimation.state.Complete += OnCompleteAnimation; |
skeletonAnimation.state.Complete += OnCompleteAnimation; |
||
− | } |
||
− | else if (skeletonGraphic) |
||
− | { |
||
− | skeletonGraphic.AnimationState.Complete += OnCompleteAnimation; |
||
} |
} |
||
} |
} |
||
Line 1,008: | Line 951: | ||
{ |
{ |
||
skeletonAnimation.state.Complete -= OnCompleteAnimation; |
skeletonAnimation.state.Complete -= OnCompleteAnimation; |
||
− | } |
||
− | else if (skeletonGraphic) |
||
− | { |
||
− | skeletonGraphic.AnimationState.Complete -= OnCompleteAnimation; |
||
} |
} |
||
} |
} |
||
Line 1,026: | Line 965: | ||
skeletonAnimation.state.Complete -= OnCompleteAnimation; |
skeletonAnimation.state.Complete -= OnCompleteAnimation; |
||
skeletonAnimation.state.Complete += OnCompleteAnimation; |
skeletonAnimation.state.Complete += OnCompleteAnimation; |
||
− | } |
||
− | else if (skeletonGraphic) |
||
− | { |
||
− | skeletonGraphic.AnimationState.Complete -= OnCompleteAnimation; |
||
− | skeletonGraphic.AnimationState.Complete += OnCompleteAnimation; |
||
} |
} |
||