public void ShowSecondaryActionType()
    {
        if (!facade.GrabConfiguration.SecondaryAction)
        {
            if (GUILayout.Button("Generate Secondary Action"))
            {
                SwitchSecondaryAction();
            }
        }
        else
        {
            if (interactibleObject.GetComponent <ClimbableObject>())
            {
                return;
            }

            MyEditorTools.BeginHorizontal();

            var secondaryType = (InteractibleObject.SecondaryTypes)EditorGUILayout.EnumPopup("SecondaryAction", interactibleObject.secondaryAction);

            if (interactibleObject.secondaryAction != secondaryType)
            {
                Undo.RecordObject(interactibleObject, "Changed Secondary Type");
                interactibleObject.secondaryAction = secondaryType;
                SwitchSecondaryAction();
                Undo.CollapseUndoOperations(Undo.GetCurrentGroup());
            }


            MyEditorTools.ShowRefrenceButton(facade.GrabConfiguration.SecondaryAction.gameObject);


            MyEditorTools.EndHorizontal();
        }
    }
    void ShowEvents()
    {
        FindEvents();

        MyEditorTools.BeginHorizontal();
        bool eventBool = EditorGUILayout.BeginFoldoutHeaderGroup(interactibleObject.eventBool, "Event Actions");

        MyEditorTools.ShowRefrenceButton(facade.gameObject);
        EditorGUILayout.EndFoldoutHeaderGroup();
        MyEditorTools.EndHorizontal();

        if (interactibleObject.eventBool != eventBool)
        {
            Undo.RecordObject(interactibleObject, "Toggled Event Foldout");
            interactibleObject.eventBool = eventBool;
        }

        if (interactibleObject.eventBool)
        {
            EditorGUILayout.PropertyField(firstTouched);
            EditorGUILayout.PropertyField(touchedAction);
            EditorGUILayout.PropertyField(unTouchedAction);
            EditorGUILayout.PropertyField(lastUnTouchedAction);

            EditorGUILayout.PropertyField(firstGrabbed);
            EditorGUILayout.PropertyField(grabbedAction);
            EditorGUILayout.PropertyField(unGrabbedAction);
            EditorGUILayout.PropertyField(lastUngrabbedAction);

            serializedFacade.ApplyModifiedProperties();
        }
    }
Esempio n. 3
0
    void ShowDriveLimit()
    {
        MyEditorTools.BeginHorizontal();

        if (drive.driveType == DriveObject.DriveType.Directional)
        {
            drive.dirDriveFacade.DriveLimit = EditorGUILayout.FloatField("Drive Limit",
                                                                         drive.dirDriveFacade.DriveLimit);
        }
        else if (drive.driveType == DriveObject.DriveType.Rotational)
        {
            Vector2 newLimits = EditorGUILayout.Vector2Field("Drive Limits",
                                                             new Vector2(drive.rotDriveFacade.DriveLimit.minimum,
                                                                         drive.rotDriveFacade.DriveLimit.maximum));
            drive.rotDriveFacade.DriveLimit = new FloatRange(newLimits.x, newLimits.y);
        }

        if (!Application.isPlaying)
        {
            if (GUILayout.Button(drive.previewBool ? "Stop Preview" : "Preview Drive"))
            {
                drive.previewBool = !drive.previewBool;
            }
        }

        MyEditorTools.EndHorizontal();

        if (!Application.isPlaying)
        {
            ShowPreview();
        }
    }
Esempio n. 4
0
    private void ShowInteractibleGUI()
    {
        GUILayout.Space(10);

        MyEditorTools.BeginHorizontal();

        bool interactibleBool = EditorGUILayout.BeginFoldoutHeaderGroup(drive.interactibleBool, "Interactible Object");

        EditorGUILayout.EndFoldoutHeaderGroup();

        MyEditorTools.ShowRefrenceButton(drive.interactibleObject.gameObject);

        MyEditorTools.EndHorizontal();

        if (drive.interactibleBool != interactibleBool)
        {
            Undo.RecordObject(drive, "Toggled eventsBool");
            drive.interactibleBool = interactibleBool;
        }

        if (drive.interactibleBool)
        {
            drive.interactibleObject.isDriveChild = true;
            drive.interactibleObject.drive        = drive;

            var tempEditor = CreateEditor(drive.interactibleObject);

            ((InteractibleObject)tempEditor.target).isThis = false;
            tempEditor.OnInspectorGUI();
            SceneView.RepaintAll();
            tempEditor.serializedObject.ApplyModifiedProperties();
        }
    }
Esempio n. 5
0
    void ShowDriveSettings()
    {
        GUILayout.Space(10);

        MyEditorTools.BeginHorizontal();

        bool driveBool = EditorGUILayout.BeginFoldoutHeaderGroup(drive.driveBool, "Drive Settings");

        EditorGUILayout.EndFoldoutHeaderGroup();

        MyEditorTools.ShowRefrenceButton(
            drive.driveType == DriveObject.DriveType.Directional ?
            drive.dirDriveFacade.gameObject :
            drive.rotDriveFacade.gameObject);

        MyEditorTools.EndHorizontal();

        if (drive.driveBool != driveBool)
        {
            Undo.RecordObject(drive, "Toggled driveBool");
            drive.driveBool = driveBool;
        }

        if (drive.driveBool)
        {
            if (drive.driveType == DriveObject.DriveType.Directional)
            {
                DirectionalDriveFacade facade = drive.dirDriveFacade;

                facade.DriveAxis = (DriveAxis.Axis)EditorGUILayout.EnumPopup("Drive Axis", facade.DriveAxis);

                facade.MoveToTargetValue = EditorGUILayout.Toggle("Move To Target Value", facade.MoveToTargetValue);
                facade.TargetValue       = EditorGUILayout.Slider("Target Value", facade.TargetValue, 0, 1);
                facade.DriveSpeed        = EditorGUILayout.FloatField("Drive Speed", facade.DriveSpeed);
            }

            else
            {
                RotationalDriveFacade facade = drive.rotDriveFacade;

                facade.DriveAxis = (DriveAxis.Axis)EditorGUILayout.EnumPopup("Drive Axis", facade.DriveAxis);

                facade.MoveToTargetValue = EditorGUILayout.Toggle("Move To Target Value", facade.MoveToTargetValue);
                facade.TargetValue       = EditorGUILayout.Slider("Target Value", facade.TargetValue, 0, 1);
                facade.DriveSpeed        = EditorGUILayout.FloatField("Drive Speed", facade.DriveSpeed);
            }

            ShowDriveLimit();
        }
    }
Esempio n. 6
0
    public void OnGUI()
    {
        GUIStyle activeStyle = new GUIStyle(EditorStyles.label);

        activeStyle.normal.textColor = Color.green;

        MyEditorTools.BeginHorizontal();

        EditorGUILayout.LabelField($"In devmode:", inDev ? activeStyle : EditorStyles.label, GUILayout.Width(73));
        if (GUILayout.Button($"{PrefabsXR.inDev}", GUILayout.Width(115 - 73)))
        {
            inDev = !inDev;
        }

        PrefabsXR.inDev = inDev; MyEditorTools.EndHorizontal();
    }
Esempio n. 7
0
    void ShowValueEvents()
    {
        GUILayout.Space(10);

        MyEditorTools.BeginHorizontal();

        bool eventsBool = EditorGUILayout.BeginFoldoutHeaderGroup(drive.eventsBool, "Value Event Actions");

        EditorGUILayout.EndFoldoutHeaderGroup();

        MyEditorTools.ShowRefrenceButton(drive.valueEventsParent.gameObject);

        MyEditorTools.EndHorizontal();

        if (drive.eventsBool != eventsBool)
        {
            Undo.RecordObject(drive, "Toggled eventsBool");
            drive.eventsBool = eventsBool;
        }

        GUILayout.Space(10);

        if (drive.eventsBool)
        {
            UpdateValueEventBools(ref drive.ValueEventsBools);


            for (int i = 0; i < drive.valueEvents.Count; i++)
            {
                DriveObject.ValueEvent tempValEvent = ShowValueEvent(drive.valueEvents[i], i);

                if (tempValEvent == null)
                {
                    drive.RemoveValueEvent(drive.valueEvents[i]);
                    return;
                }

                drive.valueEvents[i] = tempValEvent;
            }

            if (GUILayout.Button("New Value Event"))
            {
                drive.CreateValueEvent();
            }
        }
    }
Esempio n. 8
0
    void ShowRangeArea(ref DriveObject.ValueEvent valueEvent)
    {
        MyEditorTools.BeginHorizontal();

        FloatRange tempRange = valueEvent.floatToBoolean.GetActivationRange();

        tempRange.minimum = EditorGUILayout.FloatField(tempRange.minimum, EditorStyles.numberField, miniFeildWidth);

        EditorGUILayout.MinMaxSlider(ref tempRange.minimum, ref tempRange.maximum, 0, 1);

        tempRange.maximum = EditorGUILayout.FloatField(tempRange.maximum, EditorStyles.numberField, miniFeildWidth);

        if (tempRange.maximum > 1)
        {
            tempRange.maximum = 1;
        }

        valueEvent.floatToBoolean.SetActivationRange(tempRange);

        MyEditorTools.EndHorizontal();
    }
    public void ShowFollowType()
    {
        MyEditorTools.BeginHorizontal();

        var followAction = new SerializedObject(interactibleObject.facade.GrabConfiguration.PrimaryAction.GetComponent <MyGrabInteractableFollowAction>());
        var type         = followAction.FindProperty("_followTracking");

        EditorGUI.BeginChangeCheck();

        var intVal =
            (int)((GrabInteractableFollowAction.TrackingType)EditorGUILayout.EnumPopup("Follow Type", (GrabInteractableFollowAction.TrackingType)type.intValue));

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(followAction.targetObject, "Changed FollowType");
            type.intValue = intVal;
            followAction.ApplyModifiedProperties();
        }

        MyEditorTools.ShowRefrenceButton(interactibleObject.facade.GrabConfiguration.PrimaryAction.gameObject);
        MyEditorTools.EndHorizontal();
    }
Esempio n. 10
0
    DriveObject.ValueEvent ShowValueEvent(DriveObject.ValueEvent valueEvent, int i)
    {
        MyEditorTools.BeginHorizontal();

        drive.ValueEventsBools[i] = EditorGUILayout.BeginFoldoutHeaderGroup(drive.ValueEventsBools[i], "Positive Bounds");
        EditorGUILayout.EndFoldoutHeaderGroup();

        ShowRangeArea(ref valueEvent);

        if (ShowRemoveButton(valueEvent))
        {
            return(null);
        }

        MyEditorTools.EndHorizontal();

        if (drive.ValueEventsBools[i])
        {
            ShowValueEvents(valueEvent.booleanAction);
        }

        return(valueEvent);
    }
Esempio n. 11
0
    void ShowPreview()
    {
        if (drive.previewBool)
        {
            MyEditorTools.BeginHorizontal();
            previewValue = EditorGUILayout.Slider(previewValue, 0, 1);

            if (GUILayout.Button("CNTR", MyEditorTools.miniFeildWidth))
            {
                previewValue = 0.5f;
            }

            MyEditorTools.EndHorizontal();
        }

        if (drive.driveType == DriveObject.DriveType.Directional)
        {
            drive.SetPreviewDrivePosition(drive.previewBool ? previewValue : .5f);
        }
        else
        {
            drive.SetPreviewDriveRotation(drive.previewBool ? previewValue : .5f);
        }
    }