Exemple #1
0
    public int[,] GenerateMap(int size, int roomNumber, int minRoomSize, int maxRoomSize)
    {
        llRooms.Clear();
        v2iMapSize = new Vector2Int(size, size);
        iRoomCount = roomNumber;
        iMinRoomSize = minRoomSize;
        iMaxRoomSize = maxRoomSize;

        CheckForInvalidParameters();

        map = new int[v2iMapSize.x, v2iMapSize.y];

        GenerateRooms();
        GenerateCorridors();

        map = op.PlaceElementsInMap(map, llRooms);

        StreamWriter writer = new StreamWriter("Assets/Data/Map1.txt");
        for(int i=0; i< size; i++)
        {
            for(int j=0; j< size; j++)
            {
                writer.Write(map[i, j]);
            }
            writer.Write("\n");

        }

        writer.Close();
        return map;
    }