private static void testShape() { Shape shape = new Shape(ConsoleColor.Blue, 3, 7); Console.WriteLine(shape); Shape extraShape = new ExtraShape(ConsoleColor.DarkBlue, 8, 3, Direction.LEFT); Console.WriteLine(extraShape); }
public static Shape create(Random random, int maxX, int maxY) { Shape result = null; ConsoleColor color = Shape.getRandomColor(random); int x = random.Next(maxX); int y = random.Next(maxY); switch (random.Next(2)) { case 0: result = new Shape(color, x, y); break; case 1: result = new ExtraShape(color, x, y, ExtraShape.getRandomDirection(random)); break; } return result; }