Ejemplo n.º 1
0
    public void constructPartialMazeCenter(MazeBlueprint blueprint, int startRow, int startCol, int endRow, int endCol)
    {
        this.adjustBorder(ref blueprint, ref startRow, ref startCol, ref endRow, ref endCol);
        this.initTileList();
        this.initTilePositionList();

        int width  = (endCol - startCol);
        int height = (endRow - startRow);

        // center point
        int pivotX = startCol + width / 2;
        int pivotY = startRow + height / 2;

        for (int i = 0; i < height / 2; i++)
        {
            for (int j = 0; j < width / 2; j++)
            {
                if (!(this.isTileDrawn(pivotX + j, pivotY + i)))
                {
                    String tileType = blueprint.getTileType(pivotY + i, pivotX + j);
                    if (tileType != "Empty")
                    {
                        addTile(pivotX + j, pivotY + i, drawableTiles.getTile(tileType));
                    }
                }

                if (!(this.isTileDrawn(pivotX - j, pivotY + i)))
                {
                    String tileType = blueprint.getTileType(pivotY + i, pivotX - j);
                    if (tileType != "Empty")
                    {
                        addTile(pivotX - j, pivotY + i, drawableTiles.getTile(tileType));
                    }
                }
            }
            for (int j = 0; j < width / 2; j++)
            {
                if (!(this.isTileDrawn(pivotX + j, pivotY - i)))
                {
                    String tileType = blueprint.getTileType(pivotY - i, pivotX + j);
                    if (tileType != "Empty")
                    {
                        addTile(pivotX + j, pivotY - i, drawableTiles.getTile(tileType));
                    }
                }

                if (!(this.isTileDrawn(pivotX - j, pivotY - i)))
                {
                    String tileType = blueprint.getTileType(pivotY - i, pivotX - j);
                    if (tileType != "Empty")
                    {
                        addTile(pivotX - j, pivotY - i, drawableTiles.getTile(tileType));
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
    /* =================================================
    *                   Main Method
    *  ================================================= */

    public void constructMaze(MazeBlueprint blueprint)
    {
        this.initTileList();
        this.initTilePositionList();

        for (int i = 0; i < blueprint.getMazeHeight(); i++)
        {
            for (int j = 0; j < blueprint.getMazeWidth(); j++)
            {
                String tileType = blueprint.getTileType(i, j);
                if (tileType != "Empty")
                {
                    addTile(j, i, drawableTiles.getTile(tileType));
                }
            }
        }
    }
Ejemplo n.º 3
0
    public void constructPartialMaze(MazeBlueprint blueprint, int startRow, int startCol, int endRow, int endCol)
    {
        this.adjustBorder(ref blueprint, ref startRow, ref startCol, ref endRow, ref endCol);
        this.initTileList();
        this.initTilePositionList();

        for (int i = startRow; i < endRow; i++)
        {
            for (int j = startCol; j < endCol; j++)
            {
                if (this.isTileDrawn(j, i))
                {
                    break;
                }

                String tileType = blueprint.getTileType(i, j);
                if (tileType != "Empty")
                {
                    addTile(j, i, drawableTiles.getTile(tileType));
                }
            }
        }
    }