//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// bool WeHaveAllTheStuff() { if (!(animFollow = GetComponent <AnimFollow_AF>())) { Debug.LogWarning("Missing Script: AnimFollow on " + this.name + "\n"); return(false); } else if (!(master = animFollow.master)) { Debug.LogWarning("master not assigned in AnimFollow script on " + this.name + "\n"); return(false); } #if SIMPLEFOOTIK else if (!(simpleFootIK = master.GetComponent <SimpleFootIK_AF>())) { UnityEngine.Debug.LogWarning("Missing script SimpleFootIK script on " + master.name + ".\nAdd it or comment out the directive from top line in the AnimFollow script." + "\n"); return(false); } #else else if (master.GetComponent <SimpleFootIK_AF>()) { UnityEngine.Debug.LogWarning("There is a SimpleFootIK script on\n" + master.name + " But the directive in the AnimFollow script is commented out" + "\n"); return(false); } #endif else if (!master.activeInHierarchy) { Debug.LogWarning("Master of " + this.name + " is not active" + "\n"); return(false); } else { if (!ragdollRootBone) { ragdollRootBone = GetComponentInChildren <Rigidbody>().transform; // Debug.Log("ragdollRootBone not assigned in RagdollControll script on " + this.name + ".\nAuto assigning to " + ragdollRootBone.name + "\nThis is probably correct if this is a standard biped." + "\n"); } else if (!ragdollRootBone.GetComponent <Rigidbody>() || !(ragdollRootBone.root == this.transform.root)) { ragdollRootBone = GetComponentInChildren <Rigidbody>().transform; Debug.LogWarning("ragdollRootBone in RagdollControll script on " + this.name + " has no rigid body component or is not child of ragdoll.\nAuto assigning to " + ragdollRootBone.name + "\nAuto assignment is probably correct if this is a standard biped." + "\n"); } int i = 0; Transform[] transforms = GetComponentsInChildren <Transform>(); foreach (Transform transformen in transforms) // Find the masterRootBoone { if (transformen == ragdollRootBone) { masterRootBone = master.GetComponentsInChildren <Transform>()[i]; break; } i++; } } /*if (!(playerMovement = master.GetComponent<PlayerMovement_AF>())) * { * Debug.LogWarning("Missing Script: PlayerMovement on " + master.name + "\n"); * return(false); * }*/ if (!(animator = master.GetComponent <Animator>())) { Debug.LogWarning("Missing Animator on " + master.name + "\n"); return(false); } else { if (animator.cullingMode != AnimatorCullingMode.AlwaysAnimate) { Debug.Log("Animator cullingmode on " + this.name + " is not set to always animate.\nIf the masteris hidden the animations will not run." + "\n"); } if (!animator.updateMode.Equals(AnimatorUpdateMode.AnimatePhysics)) { Debug.Log("Animator on " + this.name + " is not set to animate physics" + "\n"); } } if (IceOnGetup.Length == 0) { Debug.Log("Assign left and right calf and thigh to iceOnGetup in script RagdollControl on " + this.name + "\n"); } else if (IceOnGetup[IceOnGetup.Length - 1] == null) { Debug.LogWarning("Assign left and right calf and thigh to iceOnGetup in script RagdollControl on " + this.name + "\nDo not leave elements as null." + "\n"); return(false); } if (!(hash = master.GetComponent <HashIDs_AF>())) { Debug.LogWarning("Missing Script: HashIDs on " + master.name + "\n"); return(false); } if (fellOnSpeed) { print("This will never show and is here just to avoid a compiler warning"); } return(true); }
void Start() { if (animFollow_S = GetComponent <AnimFollow_AF>()) { if (animFollow_S.version != version) { Debug.LogWarning("AnimFollow on " + this.transform.name + " is not version " + version + " but the ResizeProfiles script is"); } int j = GetComponentsInChildren <Rigidbody>().Length; int i = animFollow_S.maxTorqueProfile.Length; System.Array.Resize(ref animFollow_S.maxTorqueProfile, j); for (int n = 1; n <= j - i; n++) { animFollow_S.maxTorqueProfile[j - n] = animFollow_S.maxTorqueProfile[i - 1]; } i = animFollow_S.maxForceProfile.Length; System.Array.Resize(ref animFollow_S.maxForceProfile, j); for (int n = 1; n <= j - i; n++) { animFollow_S.maxForceProfile[j - n] = animFollow_S.maxForceProfile[i - 1]; } i = animFollow_S.maxJointTorqueProfile.Length; System.Array.Resize(ref animFollow_S.maxJointTorqueProfile, j); for (int n = 1; n <= j - i; n++) { animFollow_S.maxJointTorqueProfile[j - n] = animFollow_S.maxJointTorqueProfile[i - 1]; } i = animFollow_S.jointDampingProfile.Length; System.Array.Resize(ref animFollow_S.jointDampingProfile, j); for (int n = 1; n <= j - i; n++) { animFollow_S.jointDampingProfile[j - n] = animFollow_S.jointDampingProfile[i - 1]; } i = animFollow_S.PTorqueProfile.Length; System.Array.Resize(ref animFollow_S.PTorqueProfile, j); for (int n = 1; n <= j - i; n++) { animFollow_S.PTorqueProfile[j - n] = animFollow_S.PTorqueProfile[i - 1]; } i = animFollow_S.PForceProfile.Length; System.Array.Resize(ref animFollow_S.PForceProfile, j); for (int n = 1; n <= j - i; n++) { animFollow_S.PForceProfile[j - n] = animFollow_S.PForceProfile[i - 1]; } i = animFollow_S.forceErrorWeightProfile.Length; System.Array.Resize(ref animFollow_S.forceErrorWeightProfile, j); for (int n = 1; n <= j - i; n++) { animFollow_S.forceErrorWeightProfile[j - n] = animFollow_S.forceErrorWeightProfile[i - 1]; } } else { Debug.LogWarning("There is no AnimFollow script on this game object. \nUnable to resize profiles"); } #if UNITY_EDITOR EditorUtility.SetDirty(animFollow_S); #endif DestroyImmediate(this); }