Exemple #1
0
    public TileBase[,] BuildRoom(int width, int height)
    {
        TileBase[,] room = new TileBase[width, height];
        Dictionary <string, TileBase> tileDict = TileLoader.LoadRoom("Color", 1);

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                if ((x == 0) && (y == 0))
                {
                    room[x, y] = tileDict["botLeft"];
                }
                else if ((x == (width - 1)) && (y == 0))
                {
                    room[x, y] = tileDict["botRight"];
                }
                else if ((x == 0) && (y == height - 1))
                {
                    room[x, y] = tileDict["topLeft"];
                }
                else if ((x == width - 1) && (y == height - 1))
                {
                    room[x, y] = tileDict["topRight"];
                }
                else if (y == 0)
                {
                    room[x, y] = tileDict["bot"];
                }
                else if (y == height - 1)
                {
                    room[x, y] = tileDict["top"];
                }
                else if (x == 0)
                {
                    room[x, y] = tileDict["left"];
                }
                else if (x == width - 1)
                {
                    room[x, y] = tileDict["right"];
                }
            }
        }
        return(room);
    }