Example #1
0
 void Update()
 {
     if (Input.GetButtonDown("Jump"))
     {
         ClearMap();
         var bsp = new BSPGenerator(40, 40, 15, 9, 1, true, tilemapFloor, tilemapWall, floor, wall);
         bsp.NewMap();
     }
 }
Example #2
0
 void Start()
 {
     if (tilemapFloor == null || tilemapWall == null)
     {
         Debug.Log("No tilemaps!!!");
     }
     else
     {
         var bsp = new BSPGenerator(40, 40, 15, 9, 1, false, tilemapFloor, tilemapWall, floor, wall); //Generate new BSP map. It's just for demo, you can set any map you want
         bsp.NewMap();
     }
 }
Example #3
0
    public void GenerateNewMap(string mapType)
    {
        switch (mapType)
        {
        case "Tunneling":
            var tunn = new Tunneling(width, height, maxTunnels, maxTunnelLength, minTunnelLength, tunnelWidth,
                                     maxRRoomSize, minRRoomSize, maxCRoomRadius, minCRoomRadius,
                                     buildRectRoom, buildCircleRoom, randomTunnelWidth,
                                     floor, wall, floorTile, wallTile);
            tunn.NewMap();
            if (decorations.Count > 0)
            {
                PlaceDecorations();
            }
            break;

        case "CellularAutomata":
            var cellular = new Cellurar(width, height, deathLimit, birthLimit, numberOfSteps,
                                        chanceToStartAlive, floor, wall, floorTile, wallTile);
            cellular.NewMap();
            if (decorations.Count > 0)
            {
                PlaceDecorations();
            }
            break;

        case "BSP":
            var bsp = new BSPGenerator(width, height, maxLeafSize, minLeafSize,
                                       hallsWidth, randomHallWidth, floor, wall, floorTile, wallTile);
            bsp.NewMap();
            if (decorations.Count > 0)
            {
                PlaceDecorations();
            }
            break;

        case "Maze":
            var maze = new MazeGenerator(width, height, chanceOfEmptySpace, floor, wall, floorTile, wallTile);
            maze.NewMap();
            if (decorations.Count > 0)
            {
                PlaceDecorations();
            }
            break;
        }
    }