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();
        }
    }
Esempio n. 2
0
    public void ShowHand(ref bool handBool, InputManager hand)
    {
        EditorGUILayout.BeginHorizontal();

        bool tempHandBool = EditorGUILayout.Foldout(handBool, $"{hand.handedness} Hand", true);

        MyEditorTools.ShowRefrenceButton(hand.gameObject);
        GUILayout.Space(5);

        EditorGUILayout.EndHorizontal();

        if (handBool != tempHandBool)
        {
            Undo.RecordObject(rig, "Toggled hand Foldout");
            handBool = tempHandBool;
        }

        if (handBool)
        {
            var tempEditor = CreateEditor(hand);

            tempEditor.OnInspectorGUI();
            SceneView.RepaintAll();
            tempEditor.serializedObject.ApplyModifiedProperties();
        }

        if (hand.rig == null)
        {
            hand.rig = rig;
        }
    }
    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. 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
    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();
            }
        }
    }
    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();
    }