mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
Merge branch '3.8' into 3.9-beta
This commit is contained in:
commit
30eae619d2
@ -319,7 +319,8 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
GameObject commonParentObject = new GameObject(skeletonUtility.name + " HingeChain Parent " + utilityBone.name);
|
||||
var commonParentActivateOnFlip = commonParentObject.AddComponent<ActivateBasedOnFlipDirection>();
|
||||
commonParentActivateOnFlip.skeletonRenderer = skeletonUtility.SkeletonComponent;
|
||||
commonParentActivateOnFlip.skeletonRenderer = skeletonUtility.skeletonRenderer;
|
||||
commonParentActivateOnFlip.skeletonGraphic = skeletonUtility.skeletonGraphic;
|
||||
|
||||
// HingeChain Parent
|
||||
// Needs to be on top hierarchy level (not attached to the moving skeleton at least) for physics to apply proper momentum.
|
||||
|
||||
@ -39,21 +39,24 @@ namespace Spine.Unity {
|
||||
/// </summary>
|
||||
public class ActivateBasedOnFlipDirection : MonoBehaviour {
|
||||
|
||||
public ISkeletonComponent skeletonRenderer;
|
||||
public SkeletonRenderer skeletonRenderer;
|
||||
public SkeletonGraphic skeletonGraphic;
|
||||
public GameObject activeOnNormalX;
|
||||
public GameObject activeOnFlippedX;
|
||||
HingeJoint2D[] jointsNormalX;
|
||||
HingeJoint2D[] jointsFlippedX;
|
||||
ISkeletonComponent skeletonComponent;
|
||||
|
||||
bool wasFlippedXBefore = false;
|
||||
|
||||
private void Start () {
|
||||
jointsNormalX = activeOnNormalX.GetComponentsInChildren<HingeJoint2D>();
|
||||
jointsFlippedX = activeOnFlippedX.GetComponentsInChildren<HingeJoint2D>();
|
||||
skeletonComponent = skeletonRenderer != null ? (ISkeletonComponent)skeletonRenderer : (ISkeletonComponent)skeletonGraphic;
|
||||
}
|
||||
|
||||
private void FixedUpdate () {
|
||||
bool isFlippedX = (skeletonRenderer.Skeleton.ScaleX < 0);
|
||||
bool isFlippedX = (skeletonComponent.Skeleton.ScaleX < 0);
|
||||
if (isFlippedX != wasFlippedXBefore) {
|
||||
HandleFlip(isFlippedX);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user