Esempio n. 1
0
    public     GenTile[,] ResizeTiles(GenTile[,] original, ref int gx, ref int gy)
    {
        GenTile[,] empty = new GenTile[WidthT, HeightT];

        empty.Place(gx - MinX, gy - MinY, original);

        gx = MinX;
        gy = MinY;

        return(empty);
    }
Esempio n. 2
0
    public static string Print(this GenData target, bool simple = true)
    {
        if (simple)
        {
            PrintCount++;
            GenTile[,] tile = target.TileMap;
            StringBuilder sb = new StringBuilder();

            for (int y = 0; y < tile.GetLength(1); y++)
            {
                for (int x = 0; x < tile.GetLength(0); x++)
                {
                    if (tile[x, y] == null)
                    {
                        sb.Append(' ');
                        continue;
                    }
                    int       max    = tile[x, y].Details.Max(d => d.Priority);
                    GenDetail toDraw = tile[x, y].Details.Where(d => d.Priority == max).First();

                    sb.Append(toDraw.Char);
                }
                //sb.Append('\n');
            }

            return(sb.ToString());
        }
        else
        {
            GenTile[,] work = new GenTile[target.Width, target.Height];

            foreach (var room in target.Rooms)
            {
                work.Place(room.PosX, room.PosY, room.Data);
            }

            target.TileMap = work;
            return(Print(target));
        }
    }