mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Use public properties in examples.
* Use public Rotation property instead of internal rotation field in code example to allow Spine to be imported in Plugins folder * Use public Attachment property instead of internal attachment field to allow Spine to be imported in Plugins folder
This commit is contained in:
parent
7999610a24
commit
ba129b7b90
@ -27,7 +27,7 @@ namespace Spine.Unity.Examples {
|
|||||||
|
|
||||||
hipBone = skeleton.FindBone(hip);
|
hipBone = skeleton.FindBone(hip);
|
||||||
headBone = skeleton.FindBone(head);
|
headBone = skeleton.FindBone(head);
|
||||||
baseHeadRotation = headBone.rotation;
|
baseHeadRotation = headBone.Rotation;
|
||||||
|
|
||||||
skeletonAnimation.UpdateLocal += UpdateLocal;
|
skeletonAnimation.UpdateLocal += UpdateLocal;
|
||||||
}
|
}
|
||||||
@ -35,8 +35,8 @@ namespace Spine.Unity.Examples {
|
|||||||
private void UpdateLocal (ISkeletonAnimation animated) {
|
private void UpdateLocal (ISkeletonAnimation animated) {
|
||||||
hipRotationTarget = planter.Balance * hipTiltScale;
|
hipRotationTarget = planter.Balance * hipTiltScale;
|
||||||
hipRotationSmoothed = Mathf.MoveTowards(hipRotationSmoothed, hipRotationTarget, Time.deltaTime * hipRotationMoveScale * Mathf.Abs(2f * planter.Balance / planter.offBalanceThreshold));
|
hipRotationSmoothed = Mathf.MoveTowards(hipRotationSmoothed, hipRotationTarget, Time.deltaTime * hipRotationMoveScale * Mathf.Abs(2f * planter.Balance / planter.offBalanceThreshold));
|
||||||
hipBone.rotation = hipRotationSmoothed;
|
hipBone.Rotation = hipRotationSmoothed;
|
||||||
headBone.rotation = baseHeadRotation + (-hipRotationSmoothed * headTiltScale);
|
headBone.Rotation = baseHeadRotation + (-hipRotationSmoothed * headTiltScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,11 +48,11 @@ namespace Spine.Unity.Examples {
|
|||||||
shockTimer -= Time.deltaTime;
|
shockTimer -= Time.deltaTime;
|
||||||
|
|
||||||
if (shockTimer > 0) {
|
if (shockTimer > 0) {
|
||||||
eyeSlot.attachment = shockEye;
|
eyeSlot.Attachment = shockEye;
|
||||||
mouthSlot.attachment = shockMouth;
|
mouthSlot.Attachment = shockMouth;
|
||||||
} else {
|
} else {
|
||||||
eyeSlot.attachment = normalEye;
|
eyeSlot.Attachment = normalEye;
|
||||||
mouthSlot.attachment = normalMouth;
|
mouthSlot.Attachment = normalMouth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user