private static void _RecursiveLinkTransformsByName(Transform ragdoll, Transform body, Transform bodyMatchTransform, ref Transform ragdollMatchTransform, ref bool foundMatch) { ragdollMatchTransform = null; for (int i = 0; i < ragdoll.childCount; i++) { Transform childAtIndex = FindChildHelper.GetChildAtIndex(ragdoll, i); Transform transform2 = FindChildHelper.FindChildByName(childAtIndex.name, body); if (transform2 != null) { childAtIndex.position = transform2.position; childAtIndex.rotation = transform2.rotation; if (!foundMatch && (transform2 == bodyMatchTransform)) { foundMatch = true; ragdollMatchTransform = childAtIndex; } if (foundMatch) { _RecursiveLinkTransformsByName(childAtIndex, transform2); } else { _RecursiveLinkTransformsByName(childAtIndex, transform2, bodyMatchTransform, ref ragdollMatchTransform, ref foundMatch); } } } }
private static void _RecursiveLinkTransformsByName(Transform ragdoll, Transform body) { for (int i = 0; i < ragdoll.childCount; i++) { Transform childAtIndex = FindChildHelper.GetChildAtIndex(ragdoll, i); Transform transform2 = FindChildHelper.FindChildByName(childAtIndex.name, body); if (transform2 != null) { childAtIndex.position = transform2.position; childAtIndex.rotation = transform2.rotation; } _RecursiveLinkTransformsByName(childAtIndex, body); } }
public static Transform RandomChild(Transform transform) { int num = transform.childCount; int num1 = num; if (num1 == 0) { return(null); } if (num1 == 1) { return(transform.GetChild(0)); } return(FindChildHelper.GetChildAtIndex(transform, UnityEngine.Random.Range(0, num))); }