Пример #1
0
 public void FindBoneFromName()
 {
     ragdoll = this.GetComponentInParent <Ragdoll>();
     foreach (Transform child in ragdoll.meshRig.GetComponentsInChildren <Transform>())
     {
         if (child.name == this.name)
         {
             meshBone = child;
             return;
         }
     }
 }
Пример #2
0
        protected void Awake()
        {
#if PrivateSDK
            this.gameObject.AddComponent <RagdollTester>();
#endif

            foreach (SkinnedMeshRenderer smr in this.GetComponentsInChildren <SkinnedMeshRenderer>())
            {
                smr.updateWhenOffscreen = true;
            }
            if (!logGroup)
            {
                logGroup = this.GetComponentInChildren <LODGroup>();
            }
            animator.applyRootMotion = false;
            animator.cullingMode     = AnimatorCullingMode.AlwaysAnimate;
            animator.enabled         = false;
            ragdoll = this.GetComponentInChildren <Ragdoll>();

            brain     = this.GetComponentInChildren <Brain>();
            equipment = this.GetComponentInChildren <Equipment>();
            if (!container)
            {
                container = this.GetComponentInChildren <Container>();
            }

            locomotion = this.GetComponent <Locomotion>();
            mana       = this.GetComponent <Mana>();
            climber    = this.GetComponentInChildren <FeetClimber>();
            speak      = this.GetComponentInChildren <CreatureSpeak>();

            foreach (RagdollHand hand in this.GetComponentsInChildren <RagdollHand>())
            {
                if (hand.side == Side.Right)
                {
                    handRight = hand;
                }
                if (hand.side == Side.Left)
                {
                    handLeft = hand;
                }
            }
            foreach (RagdollFoot foot in this.GetComponentsInChildren <RagdollFoot>())
            {
                if (foot.side == Side.Right)
                {
                    footRight = foot;
                }
                if (foot.side == Side.Left)
                {
                    footLeft = foot;
                }
            }

            if (!hashInitialized)
            {
                InitAnimatorHashs();
            }

#if !PrivateSDK
            Rigidbody locomotionRb = locomotion.GetComponent <Rigidbody>();
            locomotionRb.isKinematic = true;

            foreach (RagdollPart ragdollPart in this.GetComponentsInChildren <RagdollPart>())
            {
                Rigidbody ragdollPartRb = ragdollPart.GetComponent <Rigidbody>();
                ragdollPartRb.isKinematic = true;
                ragdollPart.transform.SetParent(ragdollPart.meshBone);
                ragdollPart.SetPositionToBone();
            }
#endif
        }