Exemplo n.º 1
0
    void TunnelingUI()
    {
        manager.maxTunnels        = EditorGUILayout.IntField("Max tunnels count", manager.maxTunnels);
        manager.maxTunnelLength   = EditorGUILayout.IntField("Max tunnel length", manager.maxTunnelLength);
        manager.minTunnelLength   = EditorGUILayout.IntField("Min tunnel length", manager.minTunnelLength);
        manager.tunnelWidth       = EditorGUILayout.IntField("Tunnel width", manager.tunnelWidth);
        manager.maxRRoomSize      = EditorGUILayout.IntField("Max rectangle room size", manager.maxRRoomSize);
        manager.minRRoomSize      = EditorGUILayout.IntField("Min rectangle room size", manager.minRRoomSize);
        manager.maxCRoomRadius    = EditorGUILayout.IntField("Max circle room radius", manager.maxCRoomRadius);
        manager.minCRoomRadius    = EditorGUILayout.IntField("Min circle room radius", manager.minCRoomRadius);
        manager.buildRectRoom     = EditorGUILayout.Toggle("Build rectangle rooms", manager.buildRectRoom);
        manager.buildCircleRoom   = EditorGUILayout.Toggle("Build circle rooms", manager.buildCircleRoom);
        manager.randomTunnelWidth = EditorGUILayout.Toggle("Randomize tunnel width", manager.randomTunnelWidth);

        if (buildMap)
        {
            manager.ClearAllMaps();
            manager.GenerateNewMap("Tunneling");
        }
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        manager = (GeneratorManager)target;
        manager.generatorIndex   = EditorGUILayout.Popup("Generator type", manager.generatorIndex, manager.mapGenerators);
        manager.width            = EditorGUILayout.IntField("Map width", manager.width);
        manager.height           = EditorGUILayout.IntField("Map height", manager.height);
        manager.chanceOfDecorate = EditorGUILayout.FloatField("Chance of decorate", manager.chanceOfDecorate);
        manager.floor            = (Tilemap)EditorGUILayout.ObjectField("Tilemap for floor", manager.floor, typeof(Tilemap), true);
        manager.wall             = (Tilemap)EditorGUILayout.ObjectField("Tilemap for walls", manager.wall, typeof(Tilemap), true);
        manager.decoration       = (Tilemap)EditorGUILayout.ObjectField("Tilemap for decoration", manager.decoration, typeof(Tilemap), true);
        manager.floorTile        = (TileBase)EditorGUILayout.ObjectField("Tile for floor", manager.floorTile, typeof(TileBase), false);
        manager.wallTile         = (TileBase)EditorGUILayout.ObjectField("Tile for walls", manager.wallTile, typeof(TileBase), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("decorations"), true);
        serializedObject.ApplyModifiedProperties();

        if (clearMap)
        {
            manager.ClearAllMaps();
        }

        switch (manager.generatorIndex)
        {
        case 0:
            TunnelingUI();
            break;

        case 1:
            CellularUI();
            break;

        case 2:
            BSPGenUI();
            break;

        case 3:
            MazeUI();
            break;
        }

        GUILayout.BeginHorizontal();
        buildMap = GUILayout.Button("Generate new map");
        clearMap = GUILayout.Button("Clear map");
        GUILayout.EndHorizontal();
    }