Exemple #1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        MapSegmentBuilder mapSegment = (MapSegmentBuilder)target;

        Undo.RecordObject(mapSegment, "change builder");

        if (GUILayout.Button("Append Point"))
        {
            mapSegment.AppendPoint();
        }

        if (GUILayout.Button("Prepend Point"))
        {
            mapSegment.PrependPoint();
        }

        if (GUILayout.Button("Remove First"))
        {
            mapSegment.RemoveFirstPoint();
        }

        if (GUILayout.Button("Remove Last"))
        {
            mapSegment.RemoveLastPoint();
        }

        if (GUILayout.Button("Reverse Points"))
        {
            mapSegment.ReversePoints();
        }

        if (GUILayout.Button("Reset Points"))
        {
            mapSegment.ResetPoints();
        }

        EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);

        if (GUILayout.Button("Double Waypoint Resolution"))
        {
            if (!mapSegment.DoubleSubsegments())
            {
                Debug.Log($"{nameof(mapSegment.DoubleSubsegments)} fail");
            }
        }

        if (GUILayout.Button("Half Waypoint Resolution"))
        {
            if (!mapSegment.HalfSubsegments())
            {
                Debug.Log($"{nameof(mapSegment.HalfSubsegments)} fail");
            }
        }
    }