Exemple #1
0
 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);
 }
Exemple #2
0
 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;
 }
Exemple #3
0
 public void add( Shape shape )
 {
     shape.put(this);
 }