mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge pull request #432 from Fenrisul/master
[Unity] SkeletonAnimator lastTime calculation added to fix skipping
This commit is contained in:
commit
69e724a1da
@ -46,6 +46,7 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
|||||||
|
|
||||||
Dictionary<string, Spine.Animation> animationTable = new Dictionary<string, Spine.Animation>();
|
Dictionary<string, Spine.Animation> animationTable = new Dictionary<string, Spine.Animation>();
|
||||||
Animator animator;
|
Animator animator;
|
||||||
|
float lastTime;
|
||||||
|
|
||||||
public override void Reset () {
|
public override void Reset () {
|
||||||
base.Reset();
|
base.Reset();
|
||||||
@ -62,7 +63,7 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
|||||||
|
|
||||||
animator = GetComponent<Animator>();
|
animator = GetComponent<Animator>();
|
||||||
|
|
||||||
|
lastTime = Time.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update () {
|
void Update () {
|
||||||
@ -72,12 +73,13 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
|||||||
if (layerMixModes.Length != animator.layerCount) {
|
if (layerMixModes.Length != animator.layerCount) {
|
||||||
System.Array.Resize<MixMode>(ref layerMixModes, animator.layerCount);
|
System.Array.Resize<MixMode>(ref layerMixModes, animator.layerCount);
|
||||||
}
|
}
|
||||||
|
float deltaTime = Time.time - lastTime;
|
||||||
|
|
||||||
skeleton.Update(Time.deltaTime);
|
skeleton.Update(Time.deltaTime);
|
||||||
|
|
||||||
//apply
|
//apply
|
||||||
int layerCount = animator.layerCount;
|
int layerCount = animator.layerCount;
|
||||||
float deltaTime = Time.deltaTime;
|
|
||||||
for (int i = 0; i < layerCount; i++) {
|
for (int i = 0; i < layerCount; i++) {
|
||||||
|
|
||||||
float layerWeight = animator.GetLayerWeight(i);
|
float layerWeight = animator.GetLayerWeight(i);
|
||||||
@ -183,5 +185,7 @@ public class SkeletonAnimator : SkeletonRenderer, ISkeletonAnimation {
|
|||||||
if (_UpdateComplete != null) {
|
if (_UpdateComplete != null) {
|
||||||
_UpdateComplete(this);
|
_UpdateComplete(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastTime = Time.time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user