Ejemplo n.º 1
0
    public static TargetMatcherPosition Match(GameObject subject, Transform reference, Transform destination, float time = 1)
    {
        TargetMatcherPosition targetMatcher = subject.AddComponent <TargetMatcherPosition>();

        targetMatcher.reference       = reference;
        targetMatcher.destination     = destination;
        targetMatcher.initialDistance = (destination.position - reference.position).magnitude;
        targetMatcher.time            = time;
        return(targetMatcher);
    }
        public void MatchTarget_Sitting_CurrentSeatControl()
        {
            //print("anim event __sitdown");
            //    TargetMatcher.Match(gameObject, avatarTargets.bottom, SeatState.ConstraintSit.transform,2);
            if (SeatState == null)
            {
                return;
            }
            Transform target = SeatState.ConstraintSit.transform;

            TargetMatcherPosition.Match(gameObject, avatarTargets.bottom, target, 1);// 0.3f);
            TargetMatcherRotation.Match(gameObject, target, 0.5f);
            //animator.MatchTarget(target.position, target.rotation,
            // AvatarTarget.Body, new MatchTargetWeightMask(new Vector3(1, 1, 1), 1), 0.3f, 0.6f);
        }
        public void MatchTarget_StandingUp_CurrentSeatControl()
        {
            // print("anim event __standup");
            if (SeatState == null)
            {
                return;
            }
            Transform target = SeatState.ConstraintStandUp.transform;

            TargetMatcherPosition.Match(gameObject, gameObject.transform, target, 0.45f);
            //TargetMatcherRotation.Match(gameObject, target, 0.45f);
            //animator.MatchTarget(target.position, target.rotation,
            //SeatState.RightFoot ? AvatarTarget.RightFoot : AvatarTarget.LeftFoot
            //   AvatarTarget.Root
            //, new MatchTargetWeightMask(new Vector3(1, 1, 1), 0), 0.25f, 0.7f);
        }