Ejemplo n.º 1
0
    public LevelMapBuilder WithFloor(TilePoint tile, MapPiece piece)
    {
        if (!MapPieceSymbol.IsFloor(piece))
        {
            throw new ArgumentException($"{piece} is not a floor piece.");
        }

        var range = new TilePoint(_floors.GetLength(0), _floors.GetLength(1));

        if (tile.X > _floors.GetLength(0) || tile.X < 0)
        {
            throw new ArgumentException($"{tile} is out of range {range} for {piece}");
        }
        if (tile.Y > _floors.GetLength(1) || tile.Y < 0)
        {
            throw new ArgumentException($"{tile} is out of range {range} for {piece}");
        }

        _floors[tile.X, tile.Y] = piece;
        return(this);
    }
Ejemplo n.º 2
0
 public LevelMapBuilder With(TilePoint tile, MapPiece piece) => MapPieceSymbol.IsFloor(piece) ? WithFloor(tile, piece) : WithPiece(tile, piece);