Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            Rect levelCamerasRect = EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            EditorGUILayout.LabelField("Level Cameras", EditorStyles.boldLabel);
            CustomEditorHelper.DrawProperty(isStuntTriggerProperty);

            if (isStuntTriggerProperty.boolValue)
            {
                CustomEditorHelper.DrawProperty(linkedStuntProperty);
            }
            else
            {
                EditorGUI.indentLevel++;
                CustomEditorHelper.DrawProperty(linkedCamerasProperty);
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Shot Determination", EditorStyles.boldLabel);
            if (isStuntTriggerProperty.boolValue)
            {
                CustomEditorHelper.DrawProperty(levelShotWeightProperty, "stuntShotWeight");
            }
            else
            {
                CustomEditorHelper.DrawProperty(levelShotWeightProperty);
            }
            CustomEditorHelper.DrawProperty(mountedShotWeightProperty);

            if (!isStuntTriggerProperty.boolValue && levelShotWeightProperty.floatValue > 0 && linkedCamerasProperty.arraySize == 0)
            {
                EditorGUILayout.HelpBox("WARNING: Level shot weight is above 0, but there are no linked cameras set!", MessageType.Warning);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Track Values (Read Only)", EditorStyles.boldLabel);
            CustomEditorHelper.DrawPropertyReadOnlyLabel(distanceAlongTrackProperty, distanceAlongTrackProperty.floatValue.ToString());
            CustomEditorHelper.DrawPropertyReadOnlyLabel(percentageAlongTrackProperty, percentageAlongTrackProperty.floatValue.ToString("##0.0") + "%");
            CustomEditorHelper.DrawPropertyReadOnlyLabel(closestPointOnTrackProperty, closestPointOnTrackProperty.vector3Value.ToString());
            CustomEditorHelper.DrawPropertyReadOnlyLabel(trackDirectionProperty, trackDirectionProperty.vector3Value.ToString());
            CustomEditorHelper.DrawPropertyReadOnlyLabel(trackPerpendicularProperty, trackPerpendicularProperty.vector3Value.ToString());
            EditorGUILayout.EndVertical();

            if (GUILayout.Button("Snap To Track"))
            {
                SnapToTrack();
            }
            EditorGUILayout.HelpBox("NOTE: The trigger's automatic snapping feature doesn't work if an inspector is in debug mode.", MessageType.Info);

            serializedObject.ApplyModifiedProperties();
        }