コード例 #1
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);
        }
    }
コード例 #2
0
 public void AutoDecorate()
 {
     for (int i = Room.Bounds.Left; i < Room.Bounds.Right; i++)
     {
         for (int j = Room.Bounds.Bottom; j < Room.Bounds.Top; j++)
         {
             var type = GetTypeOfWall(i, j);
             if (type == TypeOfTile.Top)
             {
                 if (SeededRandom.RandBool(.125f))
                 {
                     DecorativeTileMap.SpawnTorch(i, j);
                 }
                 else if (SeededRandom.RandBool(.125f))
                 {
                     Level.Decorations.SetTile(new Vector3Int(i, j, 0), Painter.GetRandomTopWallDecoration());
                 }
             }
             if (type == TypeOfTile.Left && SeededRandom.RandBool(.125f) && IsFloor(i + 1, j))
             {
                 DecorativeTileMap.SpawnSideTorch(i + 1, j, true);
             }
             if (type == TypeOfTile.Right && SeededRandom.RandBool(.125f) && IsFloor(i - 1, j))
             {
                 DecorativeTileMap.SpawnSideTorch(i - 1, j, false);
             }
             if (type == TypeOfTile.Floor && SeededRandom.RandBool(.02f))
             {
                 Level.Decorations.SetTile(new Vector3Int(i, j, 0), Painter.GetRandomFloorDecoration());
             }
         }
     }
 }