示例#1
0
        void Start()
        {
            // store the Animator component
            animator = GetComponent <Animator>();
            iChar    = GetComponent <vCharacter>();

            // 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)
            {
                if (!ignoreTags.Contains(c.tag))
                {
                    BodyPart bodyPart = new BodyPart();
                    bodyPart.transform = c as Transform;
                    bodyParts.Add(bodyPart);
                }
            }
        }
示例#2
0
        void Start()
        {
            vCharacter character = GetComponent <vCharacter>();

            if (character)
            {
                character.onDead.AddListener(OnDeadHandle);
            }
        }