| | |
| | | return; |
| | | } |
| | | skeletonGraphic.enabled = true; |
| | | skeletonGraphic.MeshGenerator.settings.pmaVertexColors = skinConfig.pmaVertexColorsOpen == 1; |
| | | skeletonGraphic.Initialize(true); |
| | | |
| | | skeletonGraphic.transform.localPosition = new Vector3(skinConfig.Poses[0], skinConfig.Poses[1], 0); |
| | |
| | | // if (heroSkinID == 0) |
| | | // { |
| | | // if (hero != null && hero.gameObject.activeSelf) |
| | | // { |
| | | // hero.SetActive(false); |
| | | // } |
| | | // { |
| | | // hero.SetActive(false); |
| | | // } |
| | | // return; |
| | | // } |
| | | hero = instanceGO.GetComponentInChildren<UIHeroController>(true); |
| | | if (hero == null) |
| | | { |
| | | return; |
| | | return; |
| | | } |
| | | if (heroSkinID == 0) |
| | | { |
| | |
| | | } |
| | | hero.SetActive(true); |
| | | hero.Create(heroSkinID, _scale); |
| | | |
| | | |
| | | // 确保 BoneFollowerGraphic 引用到正确的坐骑 SkeletonGraphic |
| | | var boneFollower = hero.GetComponent<BoneFollowerGraphic>(); |
| | | if (boneFollower != null && skeletonGraphic != null && skeletonGraphic.enabled) |
| | |
| | | boneFollower.enabled = false; |
| | | hero.transform.localPosition = new Vector3(0, -50, 0); |
| | | } |
| | | |
| | | |
| | | if (isHeroShowBefore) |
| | | { |
| | | hero.transform.SetAsLastSibling(); |
| | |
| | | return; |
| | | hero.PlayAnimation(motionName, loop, replay); |
| | | } |
| | | |
| | | |
| | | public UIHeroController GetHero() |
| | | { |
| | | return hero; |
| | |
| | | /// <param name="motionName">动作名</param> |
| | | /// <param name="loop">循环</param> |
| | | /// <param name="replay">如果相同动作是否再次重播,比如跑步重播就会跳帧不顺滑</param> |
| | | public virtual void PlayAnimation(string motionName, bool loop = false, bool replay=true) |
| | | public virtual void PlayAnimation(string motionName, bool loop = false, bool replay = true) |
| | | { |
| | | if (spineAnimationState == null) return; |
| | | |
| | |
| | | } |
| | | |
| | | public void SetEnabled(bool isEnable) |
| | | { |
| | | { |
| | | if (skeletonGraphic == null) |
| | | { |
| | | return; |