Exemplo n.º 1
0
        // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            //animatorListener = animator.GetComponent<IAnimatorBehaviour>();
            //if (animatorListener != null) animatorListener.OnStateEnter(Hash.Tag_Unmounting, stateInfo, layerIndex);

            #region OldWay
            animator.SetInteger(Hash.MountSide, 0);                 //remove the side of the mounted **IMPORTANT*** otherwise it will keep trying to dismount

            rider       = animator.GetComponent <Rider3rdPerson>();
            ScaleFactor = rider.Montura.Animal.ScaleFactor;                                     //Get the scale Factor from the Montura

            LeftFoot  = animator.GetBoneTransform(HumanBodyBones.LeftFoot);
            RightFoot = animator.GetBoneTransform(HumanBodyBones.RightFoot);

            MountPoint = rider.Montura.MountPoint;

            BottomPosition = MountPoint.InverseTransformPoint((LeftFoot.position + RightFoot.position) / 2); //Convert it to Local Space
            HipPosition    = MountPoint.InverseTransformPoint(animator.rootPosition);                        //Convert it to Local Space

            Fix = rider.MountTrigger.Adjustment;                                                             //Store the Fix

            transform = animator.transform;
            rider.Start_Dismounting();

            transform.position = rider.Montura.MountPoint.position;
            transform.rotation = rider.Montura.MountPoint.rotation;

            LastRelativeRiderPosition = MountPoint.InverseTransformPoint(transform.position);
            #endregion
        }
Exemplo n.º 2
0
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            animator.SetInteger(Hash.MountSide, 0);                //remove the side of the mounted ****IMPORTANT
            rider = animator.GetComponent <Rider3rdPerson>();

            transform = animator.transform;

            AnimalScaleFactor = rider.Montura.Animal.ScaleFactor;         //Get the scale Factor from the Montura

            ResetFloatParameters(animator);

            MountTrigger = rider.MountTrigger.transform;

            Fix = rider.MountTrigger.Adjustment;            //Store the Fix

            rider.Start_Mounting();
        }
Exemplo n.º 3
0
        // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            animator.SetInteger(Hash.MountSide, 0);                 //remove the side of the mounted **IMPORTANT*** otherwise it will keep trying to dismount

            rider       = animator.GetComponent <Rider3rdPerson>();
            ScaleFactor = rider.Montura.Animal.ScaleFactor;                                     //Get the scale Factor from the Montura

            Vector3 LeftFoot  = animator.GetBoneTransform(HumanBodyBones.LeftFoot).position;
            Vector3 RightFoot = animator.GetBoneTransform(HumanBodyBones.RightFoot).position;

            laspos        = (LeftFoot + RightFoot) / 2;
            MountPosition = animator.rootPosition;

            Fix = rider.MountTrigger.Adjustment;            //Store the Fix

            transform = animator.transform;
            rider.Start_Dismounting();

            hip = animator.GetBoneTransform(HumanBodyBones.Hips);   //Get the Hip Bone
        }
Exemplo n.º 4
0
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            animator.SetInteger(Hash.MountSide, 0);                //remove the side of the mounted ****IMPORTANT

            rider = animator.GetComponent <Rider3rdPerson>();

            transform = animator.transform;
            hip       = animator.GetBoneTransform(HumanBodyBones.Hips);

            AnimalScaleFactor = rider.Montura.Animal.ScaleFactor;         //Get the scale Factor from the Montura

            ResetFloatParameters(animator);

            float CenterDiference = animator.transform.position.y - animator.pivotPosition.y;                                     //Mount Animations have the pivot on the CoG (Center of Gravity)

            transform.position = new Vector3(transform.position.x, transform.position.y + CenterDiference, transform.position.z); //Change the Position of the Rider from Feet to CoG

            MountTrigger = rider.MountTrigger.transform;

            Fix = rider.MountTrigger.Adjustment;            //Store the Fix


            rider.Start_Mounting();
        }