Exemple #1
0
 private void paintPrepFig(Graphics graphicsObj)
 {
     Figure tmp = this.preparedFigure;
     Figure paint = null;
     if (tmp is Square) paint = new Square(ColorType.BLACK, 20, this);
     if (tmp is Line) paint = new Line(ColorType.BLACK, 20, this);
     if (tmp is L) paint = new L(ColorType.BLACK, 20, this);
     if (tmp is ReverseL) paint = new ReverseL(ColorType.BLACK, 20, this);
     if (tmp is StepRight) paint = new StepRight(ColorType.BLACK, 20, this);
     if (tmp is StepLeft) paint = new StepLeft(ColorType.BLACK, 20, this);
     if (tmp is T) paint = new T(ColorType.BLACK, 20, this);
     paint.posChangePrepPaint(50, 715);
     paint.paint(graphicsObj);
 }
Exemple #2
0
 private Figure genFigure()
 {
     Random random = new Random();
     int rand = random.Next(1, 8);
     Figure ret = null;
     ColorType color = genColor();
     switch (rand)
     {
         case 1: ret = new Square(color, 20, this); break;
         case 2: ret = new Line(color, 20, this); break;
         case 3: ret = new L(color, 20, this); break;
         case 4: ret = new ReverseL(color, 20, this); break;
         case 5: ret = new StepRight(color, 20, this); break;
         case 6: ret = new StepLeft(color, 20, this); break;
         case 7: ret = new T(color, 20, this); break;
     }
     return ret;
 }