9 [CustomEditor(typeof(MixedRealityTeleport))]
12 private readonly GUIContent verticalRotationLabel =
new GUIContent(
"Vertical Rotation",
"Used to check the Horizontal Rotation and the intent of the user to rotate in that direction");
16 private static SerializedProperty teleportMakerPrefab;
17 private static SerializedProperty useCustomMappingProperty;
19 private static SerializedProperty stayOnTheFloorProperty;
20 private static SerializedProperty enableTeleportProperty;
21 private static SerializedProperty enableStrafeProperty;
22 private static SerializedProperty strafeAmountProperty;
23 private static SerializedProperty enableRotationProperty;
24 private static SerializedProperty rotationSizeProperty;
26 private static SerializedProperty leftThumbstickXProperty;
27 private static SerializedProperty leftThumbstickYProperty;
28 private static SerializedProperty rightThumbstickXProperty;
29 private static SerializedProperty rightThumbstickYProperty;
31 private static SerializedProperty horizontalStrafeProperty;
32 private static SerializedProperty forwardMovementProperty;
33 private static SerializedProperty horizontalRotationProperty;
34 private static SerializedProperty verticalRotationProperty;
36 private static bool useCustomMapping;
37 private static bool mappingOverride;
39 private void OnEnable()
43 teleportMakerPrefab = serializedObject.FindProperty(
"teleportMarker");
44 useCustomMappingProperty = serializedObject.FindProperty(
"useCustomMapping");
46 enableTeleportProperty = serializedObject.FindProperty(
"EnableTeleport");
47 enableStrafeProperty = serializedObject.FindProperty(
"EnableStrafe");
48 strafeAmountProperty = serializedObject.FindProperty(
"StrafeAmount");
49 enableRotationProperty = serializedObject.FindProperty(
"EnableRotation");
50 rotationSizeProperty = serializedObject.FindProperty(
"RotationSize");
52 stayOnTheFloorProperty = serializedObject.FindProperty(
"StayOnTheFloor");
54 leftThumbstickXProperty = serializedObject.FindProperty(
"LeftThumbstickX");
55 leftThumbstickYProperty = serializedObject.FindProperty(
"LeftThumbstickY");
56 rightThumbstickXProperty = serializedObject.FindProperty(
"RightThumbstickX");
57 rightThumbstickYProperty = serializedObject.FindProperty(
"RightThumbstickY");
59 horizontalStrafeProperty = serializedObject.FindProperty(
"HorizontalStrafe");
60 forwardMovementProperty = serializedObject.FindProperty(
"ForwardMovement");
61 horizontalRotationProperty = serializedObject.FindProperty(
"HorizontalRotation");
62 verticalRotationProperty = serializedObject.FindProperty(
"VerticalRotation");
69 serializedObject.Update();
71 useCustomMapping = useCustomMappingProperty.boolValue;
73 EditorGUILayout.LabelField(
"Teleport Options",
new GUIStyle(
"Label") { fontStyle = FontStyle.Bold });
75 EditorGUILayout.PropertyField(enableTeleportProperty,
new GUIContent(
"Enable Teleport"));
76 EditorGUILayout.PropertyField(enableStrafeProperty,
new GUIContent(
"Enable Strafe"));
77 EditorGUILayout.PropertyField(strafeAmountProperty,
new GUIContent(
"Strafe Amount"));
79 EditorGUILayout.PropertyField(enableRotationProperty,
new GUIContent(
"Enable Rotation"));
80 EditorGUILayout.PropertyField(rotationSizeProperty,
new GUIContent(
"Rotation Amount"));
82 EditorGUILayout.PropertyField(stayOnTheFloorProperty,
new GUIContent(
"Stay on the floor"));
84 EditorGUILayout.PropertyField(teleportMakerPrefab);
87 EditorGUILayout.LabelField(
"Teleport Controller Mappings",
new GUIStyle(
"Label") { fontStyle = FontStyle.Bold });
90 if (!mappingOverride &&
96 useCustomMapping =
true;
99 EditorGUI.BeginChangeCheck();
101 useCustomMapping = EditorGUILayout.Toggle(
"Use Custom Mappings", useCustomMapping);
103 if (EditorGUI.EndChangeCheck())
105 mappingOverride = !useCustomMapping;
108 useCustomMappingProperty.boolValue = useCustomMapping;
110 if (useCustomMapping)
112 EditorGUILayout.PropertyField(leftThumbstickXProperty,
new GUIContent(
"Horizontal Strafe"));
113 EditorGUILayout.PropertyField(leftThumbstickYProperty,
new GUIContent(
"Forward Movement"));
114 EditorGUILayout.PropertyField(rightThumbstickXProperty,
new GUIContent(
"Horizontal Rotation"));
115 EditorGUILayout.PropertyField(rightThumbstickYProperty,
new GUIContent(verticalRotationLabel));
119 EditorGUILayout.PropertyField(horizontalStrafeProperty,
new GUIContent(
"Horizontal Strafe"));
120 EditorGUILayout.PropertyField(forwardMovementProperty,
new GUIContent(
"Forward Movement"));
121 EditorGUILayout.PropertyField(horizontalRotationProperty,
new GUIContent(
"Horizontal Rotation"));
122 EditorGUILayout.PropertyField(verticalRotationProperty,
new GUIContent(
"Verizontal Rotation"));
125 serializedObject.ApplyModifiedProperties();