Exemple #1
0
        public override Cell[][] GetRegin(Rectangle Rec)
        {
            var Area = new Cell[Rec.Height][];

            for (int i = 0; i < Rec.Height; i++)
            {
                Area[i] = new Cell[Rec.Width];
                for (int j = 0; j < Rec.Width; j++)
                {
                    Area[i][j] = new Cell(AsciiTexture.AsciiTextures[Material.Darknes]);
                }
            }
            for (int i = 0; i < Rec.Width; i++)
            {
                int from = (Poly.IntValueForX(Rec.LeftBound + i) + Abs(Poly.IntDerivativeForX(Rec.LeftBound + i)) - Rec.TopBound);
                int to   = (Poly.IntValueForX(Rec.LeftBound + i) - Abs(Poly.IntDerivativeForX(Rec.LeftBound + i)) - Rec.TopBound);
                from = Max(0, Min(Area.Length - 1, from));
                to   = Max(0, Min(Area.Length - 1, to));
                for (int j = from; j < to; j++)
                {
                    Area[j][i] = new Cell(AsciiTexture.AsciiTextures[Material.Air])
                    {
                        Priority = ZValue
                    };
                }
            }
            return(Area);
        }