Exemple #1
0
    protected void PaintOutsideWalls(Level level)
    {
        var painter = new RoomPainter(level, this);

        painter.PaintBottomWall(Bounds.Left, Bounds.Right - 1, Bounds.Bottom);
        painter.PaintTopWall(Bounds.Left, Bounds.Right - 1, Bounds.Top - 1);
        painter.PaintLeftWall(Bounds.Bottom, Bounds.Top, Bounds.Left);
        painter.PaintRightWall(Bounds.Bottom, Bounds.Top, Bounds.Right - 1);
        painter.PaintBottomLeftCorner(Bounds.Left, Bounds.Bottom);
        painter.PaintBottomRightCorner(Bounds.Right - 1, Bounds.Bottom);
        Corners.Add(new Vector2Int(Bounds.Left, Bounds.Bottom));
        Corners.Add(new Vector2Int(Bounds.Right - 1, Bounds.Bottom));
        Corners.Add(new Vector2Int(Bounds.Left, Bounds.Top - 1));
        Corners.Add(new Vector2Int(Bounds.Right - 1, Bounds.Top - 1));
    }
Exemple #2
0
    public virtual void PaintDoors(Level level)
    {
        var painter = new RoomPainter(level, this);

        foreach (var door in ConnectionPoints.Values)
        {
            if (door.x == Bounds.Right)
            {
                painter.PaintFloor(door.x - 1, door.y);
            }
            else if (door.y == Bounds.Top)
            {
                painter.PaintFloor(door.x, door.y - 1);
            }
            else
            {
                painter.PaintFloor(door.x, door.y);
            }
            if (door.x == Bounds.Right || door.x == Bounds.Left)
            {
                var xValue = door.x == Bounds.Right ? door.x - 1 : door.x;
                if (door.y <= Bounds.Top - 2)
                {
                    painter.PaintTopWall(xValue, xValue + 1, door.y + 1);
                }
                if (door.y > Bounds.Bottom + 1)
                {
                    if (door.x == Bounds.Right)
                    {
                        painter.PaintTerrainTile(xValue, door.y - 1, SeededRandom.PickRandom(Painter.TurnLeftTiles));
                    }
                    else
                    {
                        painter.PaintTerrainTile(xValue, door.y - 1, SeededRandom.PickRandom(Painter.TurnRightTiles));
                    }
                }
                else if (door.y == Bounds.Bottom + 1)
                {
                    painter.PaintBottomWall(xValue, xValue + 1, door.y - 1);
                }
            }
            else if (door.y == Bounds.Bottom)
            {
                if (door.x < Bounds.Right - 2)
                {
                    painter.PaintTerrainTile(door.x + 1, door.y, SeededRandom.PickRandom(Painter.TurnLeftTiles));
                }
                else if (door.x == Bounds.Right - 2)
                {
                    painter.PaintRightWall(door.y, door.y + 1, door.x + 1);
                }
                if (door.x > Bounds.Left + 1)
                {
                    painter.PaintTerrainTile(door.x - 1, door.y, SeededRandom.PickRandom(Painter.TurnRightTiles));
                }
                else if (door.x == Bounds.Left + 1)
                {
                    painter.PaintLeftWall(door.y, door.y + 1, door.x - 1);
                }
            }
        }
    }