コード例 #1
0
    public override void Paint(Level level)
    {
        var painter = new RoomPainter(level, this);

        PaintOutsideWalls(level);
        painter.PaintFloorArea(Bounds.Left + 1, Bounds.Right - 2, Bounds.Bottom + 1, Bounds.Top - 2);
    }
コード例 #2
0
    public override void Decorate(Level level)
    {
        var painter = new RoomPainter(level, this);

        DecorativeTileMap.SpawnTorch(Bounds.Left + 4, Bounds.Bottom + 4);
        DecorativeTileMap.SpawnTorch(Bounds.Left + 7, Bounds.Bottom + 4);
        //level.DecorativeTileMap.SpawnSideTorch(Bounds.Left + 3, Bounds.Bottom + 4, false);
        //level.DecorativeTileMap.SpawnSideTorch(Bounds.Left + 8, Bounds.Bottom + 4, true);
        //level.DecorativeTileMap.SpawnSideTorch(Bounds.Left + 3, Bounds.Bottom + 7, false);
        //level.DecorativeTileMap.SpawnSideTorch(Bounds.Left + 8, Bounds.Bottom + 7, true);
        if (!painter.IsFloor(Bounds.Left + 3, Bounds.Top - 1))
        {
            DecorativeTileMap.SpawnTorch(Bounds.Left + 3, Bounds.Top - 1);
        }
        if (!painter.IsFloor(Bounds.Right - 4, Bounds.Top - 1))
        {
            DecorativeTileMap.SpawnTorch(Bounds.Right - 4, Bounds.Top - 1);
        }
        if (!painter.IsFloor(Bounds.Left, Bounds.Bottom + 3))
        {
            DecorativeTileMap.SpawnSideTorch(Bounds.Left + 1, Bounds.Bottom + 3, true);
        }
        if (!painter.IsFloor(Bounds.Left, Bounds.Top - 4))
        {
            DecorativeTileMap.SpawnSideTorch(Bounds.Left + 1, Bounds.Top - 4, true);
        }
        if (!painter.IsFloor(Bounds.Right - 1, Bounds.Bottom + 3))
        {
            DecorativeTileMap.SpawnSideTorch(Bounds.Right - 2, Bounds.Bottom + 3, false);
        }
        if (!painter.IsFloor(Bounds.Right - 1, Bounds.Top - 4))
        {
            DecorativeTileMap.SpawnSideTorch(Bounds.Right - 2, Bounds.Top - 4, false);
        }
    }
コード例 #3
0
    public override void Paint(Level level)
    {
        var painter = new RoomPainter(level, this);

        PaintOutsideWalls(level);
        var newRect = new RogueRect(Bounds);

        newRect.Left   += 1;
        newRect.Right   = newRect.Left + 2;
        newRect.Top    -= 2;
        newRect.Bottom += 1;
        painter.PaintFloorArea(newRect);
        newRect.Right = Bounds.Right - 2;
        newRect.Left  = newRect.Right - 2;
        painter.PaintFloorArea(newRect);
        newRect         = new RogueRect(Bounds);
        newRect.Bottom += 1;
        newRect.Top     = newRect.Bottom + 2;
        newRect.Left   += 1;
        newRect.Right  -= 2;
        painter.PaintFloorArea(newRect);
        newRect.Top    = Bounds.Top - 2;
        newRect.Bottom = newRect.Top - 2;
        painter.PaintFloorArea(newRect);
        painter.AutoPaintWalls();
    }
コード例 #4
0
ファイル: Game.cs プロジェクト: antonargunov/EndingXNA
 public void initLevel()
 {
     level             = new Level(currentLevelType, currentLevelObj);
     level.checkView   = level.checkButton.active = UserData.settings.checkView;
     level.tapControls = level.controlsButton.active = UserData.settings.tapControls;
     renderer.reset();
     roomPainter = new RoomPainter(level, level.data);
     //roomPainter.setActive(true);
     state = GAME;
 }
コード例 #5
0
ファイル: Room.cs プロジェクト: PixelMute/MysteryRogueLite
    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));
    }
コード例 #6
0
ファイル: Room.cs プロジェクト: PixelMute/MysteryRogueLite
    public virtual List <Vector2Int> GetPossibleSpawnLocations(Level level)
    {
        var res     = new List <Vector2Int>();
        var painter = new RoomPainter(level, this);

        for (int i = Bounds.Left + 1; i < Bounds.Right - 1; i++)
        {
            for (int j = Bounds.Bottom + 1; j < Bounds.Top - 1; j++)
            {
                if (painter.IsFloor(i, j))
                {
                    res.Add(new Vector2Int(i, j));
                }
            }
        }
        return(res);
    }
コード例 #7
0
    public override void Paint(Level level)
    {
        var painter = new RoomPainter(level, this);
        var center  = GetCenterPoint();

        //Helpers.DrawDebugLine(center.x, center.y);
        foreach (var door in ConnectionPoints.Values)
        {
            var start = new Vector2Int(door.x, door.y);
            if (start.y == Bounds.Top)
            {
                start.y--;
            }
            else if (start.x == Bounds.Right)
            {
                start.x--;
            }

            int rightShift = (int)center.x - start.x;
            int downShift  = (int)center.y - start.y;

            Vector2Int mid;
            Vector2Int end;

            //always goes inward first
            if (door.x == Bounds.Left || door.x == Bounds.Right)
            {
                mid = new Vector2Int(start.x + rightShift, start.y);
                end = new Vector2Int(mid.x, mid.y + downShift);
            }
            else
            {
                mid = new Vector2Int(start.x, start.y + downShift);
                end = new Vector2Int(mid.x + rightShift, mid.y);
            }

            var firstHalf  = new RogueRect(start, mid);
            var secondHalf = new RogueRect(mid, end);
            painter.PaintFloorArea(firstHalf);
            painter.PaintFloorArea(secondHalf);
        }

        painter.AutoPaintWalls();
    }
コード例 #8
0
    public override void Decorate(Level level)
    {
        Vector2Int moneyLocation;

        if (ConnectionPoints.Count > 0)
        {
            var painter    = new RoomPainter(level, this);
            var connection = ConnectionPoints.First().Value;
            if (connection.x == Bounds.Left)
            {
                level.Decorations.SetTile(new Vector3Int(Bounds.Left + 1, Bounds.Bottom + 1, 0), Painter.Bones);
                level.Decorations.SetTile(new Vector3Int(Bounds.Left + 1, Bounds.Bottom + 2, 0), Painter.Skull);
                painter.PlaceCobwebs(Bounds.Left + 2, Bounds.Bottom + 2, true);
                moneyLocation = new Vector2Int(Bounds.Left + 2, Bounds.Bottom + 1);
            }
            else if (connection.x == Bounds.Right)
            {
                level.Decorations.SetTile(new Vector3Int(Bounds.Left + 2, Bounds.Bottom + 1, 0), Painter.Bones);
                level.Decorations.SetTile(new Vector3Int(Bounds.Left + 2, Bounds.Bottom + 2, 0), Painter.Skull);
                painter.PlaceCobwebs(Bounds.Left + 1, Bounds.Bottom + 2, false);
                moneyLocation = new Vector2Int(Bounds.Left + 1, Bounds.Bottom + 1);
            }
            else if (connection.y == Bounds.Bottom)
            {
                level.Decorations.SetTile(new Vector3Int(Bounds.Left + 1, Bounds.Bottom + 1, 0), Painter.Bones);
                level.Decorations.SetTile(new Vector3Int(Bounds.Left + 2, Bounds.Bottom + 1, 0), Painter.Skull);
                painter.PlaceCobwebs(Bounds.Left + 2, Bounds.Bottom + 2, true);
                moneyLocation = new Vector2Int(Bounds.Left + 1, Bounds.Bottom + 2);
            }
            else
            {
                level.Decorations.SetTile(new Vector3Int(Bounds.Left + 1, Bounds.Bottom + 2, 0), Painter.Bones);
                level.Decorations.SetTile(new Vector3Int(Bounds.Left + 2, Bounds.Bottom + 2, 0), Painter.Skull);
                painter.PlaceCobwebs(Bounds.Left + 1, Bounds.Bottom + 1, false);
                moneyLocation = new Vector2Int(Bounds.Left + 2, Bounds.Bottom + 1);
            }
            BattleGrid.instance.SpawnMoneyOnTile(moneyLocation, 10);
        }
    }
コード例 #9
0
ファイル: Room.cs プロジェクト: PixelMute/MysteryRogueLite
    public virtual void Decorate(Level level)
    {
        var painter = new RoomPainter(level, this);

        painter.AutoDecorate();
    }
コード例 #10
0
ファイル: Room.cs プロジェクト: PixelMute/MysteryRogueLite
    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);
                }
            }
        }
    }