コード例 #1
0
        public void GenerateBarricades(IGraficPoint point, int barricades_count)
        {
            Random random = new Random();
            int    counter = 0;
            int    top, left;

            void Random()
            {
                left = random.Next(0, width);
                top  = random.Next(0, width);
            }

            while (counter < barricades_count)
            {
                Random();

                if (GraficArray[top, left].SYMBOL == '.')
                {
                    GraficArray[top, left] = point;
                    Walls[top, left]       = point.SYMBOL;
                    DrawBarricade(point, left, top);
                    counter++;
                }
            }
        }
コード例 #2
0
 private void DrawPoint(IGraficPoint point)
 {
     Console.OutputEncoding = System.Text.Encoding.UTF8;
     Console.SetCursorPosition(Left, Top);
     Console.ForegroundColor = (ConsoleColor)point.FOREGROUND;
     Console.BackgroundColor = (ConsoleColor)point.BACKGROUND;
     Console.Write(point.SYMBOL);
 }
コード例 #3
0
        private void DrawBarricade(IGraficPoint point, int left, int top)
        {
            Console.SetCursorPosition(left, top);

            Console.ForegroundColor = (ConsoleColor)point.FOREGROUND;
            Console.BackgroundColor = (ConsoleColor)point.BACKGROUND;
            Console.Write(point.SYMBOL);
        }