Beispiel #1
0
 protected override Validation <string, PairedEyeSight> CreateService(ILoggerFactory loggerFactory)
 {
     return(from skeleton in Skeleton
            .ToValidation("Failed to find the skeleton.")
            from animationManager in AnimationManager
            .ToValidation("Failed to find the animation manager.")
            from horizontalEyesControl in HorizontalEyesControl.TrimToOption()
            .Bind(animationManager.FindSeekableAnimator)
            .ToValidation("Failed to find an animation control for horizontal eyes movement.")
            from verticalEyesControl in VerticalEyesControl.TrimToOption()
            .Bind(animationManager.FindSeekableAnimator)
            .ToValidation("Failed to find an animation control for vertical eyes movement.")
            from rightEye in Markers.Find(m => RightEyeMarker.TrimToOption().Contains(m.Key))
            .ToValidation("Failed to find the right eye marker.")
            from leftEye in Markers.Find(m => LeftEyeMarker.TrimToOption().Contains(m.Key))
            .ToValidation("Failed to find the left eye marker.")
            from headBone in HeadBone.TrimToOption()
            .Map(skeleton.FindBone).Filter(i => i > -1)
            .ToValidation("Failed to find the head bone.")
            from neckBone in NeckBone.TrimToOption()
            .Map(skeleton.FindBone).Filter(i => i > -1)
            .ToValidation("Failed to find the neck bone.")
            from chestBone in ChestBone.TrimToOption()
            .Map(skeleton.FindBone).Filter(i => i > -1)
            .ToValidation("Failed to find the chest bone.")
            select new PairedEyeSight(
                skeleton,
                animationManager,
                horizontalEyesControl,
                verticalEyesControl,
                rightEye,
                leftEye,
                headBone,
                neckBone,
                chestBone,
                new Range <float>(Deg2Rad(MinEyesYaw), Deg2Rad(MaxEyesYaw), TFloat.Inst),
                new Range <float>(Deg2Rad(MinEyesPitch), Deg2Rad(MaxEyesPitch), TFloat.Inst),
                new Range <float>(Deg2Rad(MinHeadYaw), Deg2Rad(MaxHeadYaw), TFloat.Inst),
                new Range <float>(Deg2Rad(MinHeadPitch), Deg2Rad(MaxHeadPitch), TFloat.Inst),
                new Range <float>(Deg2Rad(MinNeckYaw), Deg2Rad(MaxNeckYaw), TFloat.Inst),
                new Range <float>(Deg2Rad(MinNeckPitch), Deg2Rad(MaxNeckPitch), TFloat.Inst),
                this,
                Active,
                loggerFactory));
 }
    //Setup hinges and springs
    void Start()
    {
        leftLegHinge      = LeftLegBone.GetComponent <HingeJoint>();
        leftLegBoneSpring = leftLegHinge.spring;

        rightLegHinge      = RightLegBone.GetComponent <HingeJoint>();
        rightLegBoneSpring = rightLegHinge.spring;

        rightElbowHinge      = RightElbowBone.GetComponent <HingeJoint>();
        rightElbowBoneSpring = rightElbowHinge.spring;

        leftElbowHinge      = LeftElbowBone.GetComponent <HingeJoint>();
        leftElbowBoneSpring = leftElbowHinge.spring;

        chestBoneHinge  = ChestBone.GetComponent <HingeJoint>();
        chestBoneSpring = chestBoneHinge.spring;

        headBoneHinge  = HeadBone.GetComponent <HingeJoint>();
        headBoneSpring = headBoneHinge.spring;
    }
        private void ViewBodyMenu(HumanMuscle script)
        {
            GUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            BoneNameButton(HeadBone.GetInstance(), 100);
            EditorGUILayout.Space();
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            BoneNameButton(ShoulderLeftBone.GetInstance());
            BoneNameButton(NeckBone.GetInstance(), 80);
            BoneNameButton(ShoulderRightBone.GetInstance());
            EditorGUILayout.Space();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            BoneNameButton(UpperArmLeftBone.GetInstance());
            EditorGUILayout.Space();
            BoneNameButton(UpperChestBone.GetInstance(), 100);
            EditorGUILayout.Space();
            BoneNameButton(UpperArmRightBone.GetInstance());
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            BoneNameButton(LowerArmLeftBone.GetInstance());
            EditorGUILayout.Space();
            BoneNameButton(ChestBone.GetInstance(), 100);
            EditorGUILayout.Space();
            BoneNameButton(LowerArmRightBone.GetInstance());
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            BoneNameButton(HandLeftBone.GetInstance(), 100);
            EditorGUILayout.Space();
            BoneNameButton(SpineBone.GetInstance(), 100);
            EditorGUILayout.Space();
            BoneNameButton(HandRightBone.GetInstance(), 100);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            BoneNameButton(RootBone.GetInstance(), 100);
            EditorGUILayout.Space();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            BoneNameButton(UpperLegLeftBone.GetInstance(), 150);
            BoneNameButton(UpperLegRightBone.GetInstance(), 150);
            EditorGUILayout.Space();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            BoneNameButton(LowerLegLeftBone.GetInstance(), 150);
            EditorGUILayout.Space();
            BoneNameButton(LowerLegRightBone.GetInstance(), 150);
            EditorGUILayout.Space();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            BoneNameButton(FootLeftBone.GetInstance(), 150);
            EditorGUILayout.Space();
            BoneNameButton(FootRightBone.GetInstance(), 150);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            BoneNameButton(ToesLeftBone.GetInstance(), 150);
            EditorGUILayout.Space();
            BoneNameButton(ToesRightBone.GetInstance(), 150);
            GUILayout.EndHorizontal();
        }