Exemplo n.º 1
0
        public static void PaintFlood(PaintedHillsMod mymod, Colorer colorer, int tile_x, int tile_y, Paints hue)
        {
            var peek = new Dictionary <int, ISet <int> >();

            peek[tile_x] = new HashSet <int>();
            peek[tile_x].Add(tile_y);

            do
            {
                foreach (int x in peek.Keys)
                {
                    foreach (int y in peek[x])
                    {
                        colorer.ColorTile(mymod, x, y);
                    }
                }

                int[] peek_x = peek.Keys.ToArray();
                foreach (int x in peek_x)
                {
                    int[] peek_y = peek[x].ToArray();

                    foreach (int y in peek_y)
                    {
                        AreaPainter.PeekAdjacentClearTiles(colorer.HueMap, peek, x, y);
                        peek[x].Remove(y);
                    }
                    if (peek[x].Count == 0)
                    {
                        peek.Remove(x);
                    }
                }
            } while(peek.Count > 0);
        }