예제 #1
0
        [HideInInspector] public bool inhibitRun = false;          // Set from RagdollControl

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        void Awake()
        {
            // Setting up the references.
            if (!(anim = GetComponent <Animator>()))
            {
                Debug.LogWarning("Missing Animator on " + this.name);
                inhibitMove = true;
            }
            if (!(hash = GetComponent <HashIDs_AF>()))
            {
                Debug.LogWarning("Missing Script: HashIDs on " + this.name);
                inhibitMove = true;
            }
            if (anim.avatar)
            {
                if (!anim.avatar.isValid)
                {
                    Debug.LogWarning("Animator avatar is not valid");
                }
            }
        }
예제 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        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);
        }