Ejemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        waypointGraph = (WaypointGraph)target;

        if (waypointGraph == null || waypointGraph.waypoints == null || waypointGraph.edges == null)
        {
            waypointGraph.InitializeGraph();
        }
        else if (waypointGraph.isEmpty())
        {
            waypointGraph.PopulateGraph();
        }

        waypointStr = EditorGUILayout.TextField("Waypoint: ", waypointStr);

        if (GUILayout.Button("Add Waypoint"))
        {
            waypointGraph.CreateWaypoint(waypointStr);

            waypointStr = "";
            Repaint();
        }

        fromStr = EditorGUILayout.TextField("From: ", fromStr);
        toStr   = EditorGUILayout.TextField("To: ", toStr);

        if (GUILayout.Button("Add Edge"))
        {
            waypointGraph.CreateEdge(fromStr, toStr);

            fromStr = "";
            toStr   = "";
            Repaint();
        }

        SceneView.RepaintAll();
    }