示例#1
0
    private void SetNormalRoom(RoomNode room, Map map, System.Random seed)
    {
        for (int i = 0; i < mapsetting.floorBlockNum; i++)
        {
            Vector2Int[,] temp;
            int x     = seed.Next(room.bottomLeft.x, room.topRight.x);
            int y     = seed.Next(room.bottomLeft.y, room.topRight.y);
            int sizeX = seed.Next(mapsetting.minFloorBlockSize.x, mapsetting.minRoomWidth);
            int sizeY = seed.Next(mapsetting.minFloorBlockSize.y, mapsetting.minRoomHeight);

            Vector2Int center   = new Vector2Int(x, y);
            Vector2Int pathNode = room.Path[seed.Next(0, room.Path.Count)];
            temp = SetBlockOfTiles((int)TileType.Floor, map, room, sizeX, sizeY, center);
            room.FindPathBetween(pathNode, center);
        }
        foreach (Vector2Int pos in room.Path)
        {
            map.mapMatrix[pos.x, pos.y] = (int)TileType.Floor;
        }
        SetObstales(room, map, seed, (int)TileType.Obstacle_1, mapsetting, (int)TileType.Floor);
        SetEnemies(room, map, seed, mapsetting);
    }