示例#1
0
    private void OnGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("Map");
        editedMap = EditorGUILayout.ObjectField(editedMap, typeof(Map), true) as Map;
        if (editedMap == null)
        {
            return;
        }
        GUILayout.EndHorizontal();
        if (ToggleButtonStyleNormal == null)
        {
            ToggleButtonStyleNormal  = "Button";
            ToggleButtonStyleToggled = new GUIStyle(ToggleButtonStyleNormal);
            ToggleButtonStyleToggled.normal.background = ToggleButtonStyleToggled.active.background;
        }
        if (GUILayout.Button("None", currentMode == TileEditorType.NONE ? ToggleButtonStyleToggled : ToggleButtonStyleNormal))
        {
            currentMode = TileEditorType.NONE;
        }
        if (GUILayout.Button("Standard", currentMode == TileEditorType.STANDARD ? ToggleButtonStyleToggled : ToggleButtonStyleNormal))
        {
            currentMode = TileEditorType.STANDARD;
        }
        if (GUILayout.Button("Forest", currentMode == TileEditorType.FOREST ? ToggleButtonStyleToggled : ToggleButtonStyleNormal))
        {
            currentMode = TileEditorType.FOREST;
        }
        if (GUILayout.Button("Rocks", currentMode == TileEditorType.ROCKS ? ToggleButtonStyleToggled : ToggleButtonStyleNormal))
        {
            currentMode = TileEditorType.ROCKS;
        }

        if (GUILayout.Button("Reset Map"))
        {
            editedMap.ResetMap();
        }
        if (GUILayout.Button("Test"))
        {
            GameManagerScript.GetAllBuilding();
        }
        GUILayout.Label("Roads", EditorStyles.boldLabel);
        if (GUILayout.Button("Add road"))
        {
            editedRoad = new GameObject("Road").AddComponent <Road>();
            editedRoad.transform.position = Vector3.zero;
            for (int i = 0; i < 3; i++)
            {
                editedRoad.AddWaypoint(Vector3.zero, editedMap);
            }
        }
        editedRoad = EditorGUILayout.ObjectField(editedRoad, typeof(Road), true) as Road;
        if (editedRoad != null)
        {
            EditRoad();
        }
    }
示例#2
0
 void EditRoad()
 {
     if (GUILayout.Button("Add waypoint"))
     {
         editedRoad.AddWaypoint(editedRoad.WayPoints[editedRoad.WayPoints.Count - 1].transform.position, editedMap);
     }
     GUILayout.Label("Road sprites", EditorStyles.boldLabel);
     pack = EditorGUILayout.ObjectField(pack, typeof(RoadSpritePack), false) as RoadSpritePack;
     if (GUILayout.Button("Bake road"))
     {
         editedMap.Recovery();
         editedMap.BakeRoad(editedRoad, pack);
     }
 }