コード例 #1
0
    private void OnGUI()
    {
        SerializedObject obj = new SerializedObject(this);

        EditorGUILayout.PropertyField(obj.FindProperty("activeObjectPrefab"));
        obj.ApplyModifiedProperties();

        if (currentWayPointSystem == null)
        {
            if (activeObjectPrefab == null)
            {
                GUILayout.Label("No prefab selected", EditorStyles.boldLabel);
            }
            else
            {
                guiDrawer.DisplayButton("Create new waypoint system", () => { CreateNewWayPointSystem(); });
            }
        }
        else
        {
            activeLoop = EditorGUILayout.Toggle("Loop", activeLoop);
            GUILayout.Label("Create new " + activeObjectPrefab.name, EditorStyles.boldLabel);
            guiDrawer.DisplayButton("At the end", () => { currentWayPointSystem.Append(); });
            guiDrawer.DisplayButton("At the beginning", () => { currentWayPointSystem.Prepend(); });
            if (currentWPElement != null)
            {
                guiDrawer.DisplayButton("After selected", () => { currentWayPointSystem.InsertAfter(currentWPElement.GetComponent <V3WayPointObject>()); });
                guiDrawer.DisplayButton("Before selected", () => { currentWayPointSystem.InsertBefore(currentWPElement.GetComponent <V3WayPointObject>()); });
            }
            GUILayout.Label("Other options", EditorStyles.boldLabel);
            guiDrawer.DisplayButton("Save as prefab", () => { SaveAsPrefab(); });
        }
    }
コード例 #2
0
    /// <summary>
    /// Toont de uitgebreide versie van de alignbuttons.
    /// </summary>
    private void DrawAlignButtonsExt()
    {
        GUILayout.Label("Align objects to last selected", EditorStyles.boldLabel);
        guiDrawer.DisplayButton("All axis", () => { objAligner.AlignAllAxis(); });

        EditorGUILayout.BeginHorizontal();

        guiDrawer.DisplayXButton(() => { objAligner.AlignXAxis(currentSelected); }, true);
        guiDrawer.DisplayYButton(() => { objAligner.AlignYAxis(currentSelected); }, true);
        guiDrawer.DisplayZButton(() => { objAligner.AlignZAxis(currentSelected); }, true);

        EditorGUILayout.EndHorizontal();
    }