private void InitHandPoseInputList(HandInput handInput) { HandTarget handTarget = handInput.handTarget; handPoseNames = new string[handTarget.poseMixer.mixedPoses.Count]; for (int i = 0; i < handPoseNames.Length; i++) { handPoseNames[i] = handTarget.poseMixer.mixedPoses[i].pose.name; } }
public static HandInput Add(Transform parentTransform) { HandInput handInput = parentTransform.GetComponentInChildren <HandInput>(); if (handInput != null) { return(handInput); } handInput = parentTransform.gameObject.AddComponent <HandInput>(); return(handInput); }
private FootTarget GetFootTarget(HandInput settings) { if (settings == null) { return(null); } FootTarget handTarget = settings.GetComponent <FootTarget>(); if (handTarget == null) { handTarget = settings.transform.parent.GetComponent <FootTarget>(); } return(handTarget); }
private HandTarget GetHandTarget(HandInput handInput) { if (handInput == null) { return(null); } HandTarget handTarget = handInput.GetComponent <HandTarget>(); if (handTarget == null) { handTarget = handInput.transform.parent.GetComponent <HandTarget>(); } return(handTarget); }
private void CopyFromControllerInputList() { HandInput settings = (HandInput)target; HandTarget handTarget = (HandTarget)handTargetProp.objectReferenceValue; if (handTarget == null) { return; } HumanoidControl humanoid = handTarget.humanoid; ControllerInput controllerInput = humanoid.GetComponent <ControllerInput>(); if (controllerInput == null) { return; } if (handTarget.isLeft) { CopyFromControllerInput(controllerInput.leftVerticalInput, settings.controllerInput[0]); CopyFromControllerInput(controllerInput.leftHorizontalInput, settings.controllerInput[1]); CopyFromControllerInput(controllerInput.leftStickButtonInput, settings.controllerInput[2]); CopyFromControllerInput(controllerInput.leftStickTouchInput, settings.controllerInput[3]); CopyFromControllerInput(controllerInput.leftButtonOneInput, settings.controllerInput[4]); CopyFromControllerInput(controllerInput.leftButtonTwoInput, settings.controllerInput[5]); CopyFromControllerInput(controllerInput.leftButtonThreeInput, settings.controllerInput[6]); CopyFromControllerInput(controllerInput.leftButtonFourInput, settings.controllerInput[7]); CopyFromControllerInput(controllerInput.leftTrigger1Input, settings.controllerInput[8]); CopyFromControllerInput(controllerInput.leftTrigger2Input, settings.controllerInput[9]); CopyFromControllerInput(controllerInput.leftOptionInput, settings.controllerInput[10]); } else { CopyFromControllerInput(controllerInput.rightVerticalInput, settings.controllerInput[0]); CopyFromControllerInput(controllerInput.rightHorizontalInput, settings.controllerInput[1]); CopyFromControllerInput(controllerInput.rightStickButtonInput, settings.controllerInput[2]); CopyFromControllerInput(controllerInput.rightStickTouchInput, settings.controllerInput[3]); CopyFromControllerInput(controllerInput.rightButtonOneInput, settings.controllerInput[4]); CopyFromControllerInput(controllerInput.rightButtonTwoInput, settings.controllerInput[5]); CopyFromControllerInput(controllerInput.rightButtonThreeInput, settings.controllerInput[6]); CopyFromControllerInput(controllerInput.rightButtonFourInput, settings.controllerInput[7]); CopyFromControllerInput(controllerInput.rightTrigger1Input, settings.controllerInput[8]); CopyFromControllerInput(controllerInput.rightTrigger2Input, settings.controllerInput[9]); CopyFromControllerInput(controllerInput.rightOptionInput, settings.controllerInput[10]); } }
private void SetEventInput(HandInput handInput) { if (handInput.handTarget == null) { return; } showEvents = EditorGUILayout.Foldout(showEvents, "Events", true); EditorGUI.indentLevel++; if (showEvents) { SetTouchInput(serializedObject.FindProperty("touchInput"), handInput.touchInput, handInput.handTarget); SetGrabInput(serializedObject.FindProperty("grabInput"), handInput.grabInput, handInput.handTarget); } EditorGUI.indentLevel--; }
private void HandTargetInspector(HandInput handInput) { if (handInput.handTarget == null) { handInput.handTarget = handInput.GetComponent <HandTarget>(); if (handInput.handTarget == null) { handTargetProp.objectReferenceValue = (HandTarget)EditorGUILayout.ObjectField("Hand Target", handTargetProp.objectReferenceValue, typeof(HandTarget), true); if (handTargetProp.objectReferenceValue == null && handInput.transform.parent != null) { handTargetProp.objectReferenceValue = handInput.transform.parent.GetComponent <HandTarget>(); } handInput.handTarget = (HandTarget)handTargetProp.objectReferenceValue; } } }
private void CopyToControllerInputList() { HandInput handInput = (HandInput)target; HandTarget handTarget = handInput.handTarget; if (handTarget == null) { return; } ControllerInput controllerInput = handTarget.humanoid.GetComponent <ControllerInput>(); if (controllerInput == null) { return; } if (handTarget.isLeft) { CopyToControllerInput(handInput.controllerInput[0], controllerInput.leftVerticalInput); CopyToControllerInput(handInput.controllerInput[1], controllerInput.leftHorizontalInput); CopyToControllerInput(handInput.controllerInput[2], controllerInput.leftStickButtonInput); CopyToControllerInput(handInput.controllerInput[3], controllerInput.leftStickTouchInput); CopyToControllerInput(handInput.controllerInput[4], controllerInput.leftButtonOneInput); CopyToControllerInput(handInput.controllerInput[5], controllerInput.leftButtonTwoInput); CopyToControllerInput(handInput.controllerInput[6], controllerInput.leftButtonThreeInput); CopyToControllerInput(handInput.controllerInput[7], controllerInput.leftButtonFourInput); CopyToControllerInput(handInput.controllerInput[8], controllerInput.leftTrigger1Input); CopyToControllerInput(handInput.controllerInput[9], controllerInput.leftTrigger2Input); CopyToControllerInput(handInput.controllerInput[10], controllerInput.leftOptionInput); } else { CopyToControllerInput(handInput.controllerInput[0], controllerInput.rightVerticalInput); CopyToControllerInput(handInput.controllerInput[1], controllerInput.rightHorizontalInput); CopyToControllerInput(handInput.controllerInput[2], controllerInput.rightStickButtonInput); CopyToControllerInput(handInput.controllerInput[3], controllerInput.rightStickTouchInput); CopyToControllerInput(handInput.controllerInput[4], controllerInput.rightButtonOneInput); CopyToControllerInput(handInput.controllerInput[5], controllerInput.rightButtonTwoInput); CopyToControllerInput(handInput.controllerInput[6], controllerInput.rightButtonThreeInput); CopyToControllerInput(handInput.controllerInput[7], controllerInput.rightButtonFourInput); CopyToControllerInput(handInput.controllerInput[8], controllerInput.rightTrigger1Input); CopyToControllerInput(handInput.controllerInput[9], controllerInput.rightTrigger2Input); CopyToControllerInput(handInput.controllerInput[10], controllerInput.rightOptionInput); } }
private void SetHandPoseInputList(HandInput handInput) { showHandPoses = EditorGUILayout.Foldout(showHandPoses, "Hand Poses", true); if (showHandPoses) { EditorGUI.indentLevel++; if (handPoseListProp.FindPropertyRelative("Array.size").intValue <= 0) { handPoseListProp.arraySize = 1; } SerializedProperty posesProp = serializedObject.FindProperty("handPoseInput"); bool cleanupNeeded = false; for (int i = 0; i < handInput.handPoseInput.Length - 1; i++) { SerializedProperty poseProp = posesProp.GetArrayElementAtIndex(i); SetHandPoseInput(poseProp, handInput.handPoseInput[i], i, handInput.handTarget); if (handInput.handPoseInput[i].poseId == 0) { cleanupNeeded = true; } } EditorGUI.indentLevel--; if (cleanupNeeded) { CleanupKeyboardInput(ref handInput.handPoseInput); } int last = handInput.handPoseInput.Length - 1; if (handInput.handPoseInput[last] != null && handInput.handPoseInput[last].poseId == 0 /*HandPoses.PoseId.Unknown*/) { EditorGUILayout.BeginHorizontal(); //handInput.handPoseInput[last].poseId = (HandPoses.PoseId)EditorGUILayout.EnumPopup(handInput.handPoseInput[last].poseId, GUILayout.Width(80)); handInput.handPoseInput[last].poseId = EditorGUILayout.Popup(handInput.handPoseInput[last].poseId, handPoseNames, GUILayout.Width(80)); EditorGUILayout.EndHorizontal(); } else { ExtendInputList(ref handInput.handPoseInput); } } }
public void OnEnable() { handInput = (HandInput)target; if (serializedObject != null) { serializedObject.Update(); } handTargetProp = serializedObject.FindProperty("handTarget"); handPoseListProp = serializedObject.FindProperty("handPoseInput"); CopyFromControllerInputList(); if (!Application.isPlaying) { handInput.handTarget = GetHandTarget(handInput); } if (handInput.handTarget != null) { Init(handInput.handTarget.humanoid); } InitHandPoseInputList(handInput); }