Пример #1
0
 void Awake()
 {
     Instance = this;
 }
Пример #2
0
        void Start()
        {
            // store the Animator component
            animator = GetComponent<Animator>();
            tpController = GetComponent<ThirdPersonAnimator> ();

            // find character chest and hips
            characterChest = animator.GetBoneTransform(HumanBodyBones.Chest);
            characterHips = animator.GetBoneTransform(HumanBodyBones.Hips);

            // set all RigidBodies to kinematic so that they can be controlled with Mecanim
            // and there will be no glitches when transitioning to a ragdoll
            setKinematic(true);
            setCollider (true);

            // find all the transforms in the character, assuming that this script is attached to the root
            Component[] components = GetComponentsInChildren(typeof(Transform));

            // for each of the transforms, create a BodyPart instance and store the transform
            foreach (Component c in components)
            {
                BodyPart bodyPart=new BodyPart();
                bodyPart.transform=c as Transform;
                bodyParts.Add(bodyPart);
            }
        }