internal double Match(SmothendSkeleton skeleton) // distance to other person { SkeletonPoint currentRoot = CurrentSkeleton.GetPosition(JointType.HipCenter); SkeletonPoint otherRoot = skeleton.GetPosition(JointType.HipCenter); return(SkeletonMath.DistanceBetweenPoints(currentRoot, otherRoot)); }
/// <summary> /// 改变动画 /// </summary> /// <param name="dataType">动画数据类型</param> /// <param name="animName">动画名称</param> /// <param name="loop">是否循环</param> /// <param name="tarck">管道</param> private void ChangeAnim(string dataType, string animName, bool loop = false, int tarck = 0) { SkeletonDataAsset selectData = null; switch (dataType) { case "normal": selectData = NormalData; break; case "attack": selectData = AttackData; break; } if (selectData != null) { if (CurrentSkeleton.skeletonDataAsset != selectData) { if (debug) { Debug.Log($"{name} CurrentSkeleton.skeletonDataAsset != selectData"); } CurrentSkeleton.skeletonDataAsset = selectData; CurrentSkeleton.startingAnimation = animName; CurrentSkeleton.Initialize(true); CurrentSkeleton.Skeleton.SetToSetupPose(); } else { CurrentSkeleton.Initialize(true); } switch (dataType) { case "normal": AttackPos.gameObject.SetActive(false); break; case "attack": AttackPos.gameObject.SetActive(true); break; } isAdd = false; } PlayAnim(animName, loop, tarck); }