示例#1
0
 public Engine()
 {
     this.pg = new Playground(getMaxX(),getMaxY(),blocksize);
     this.trash = new LinkedList<Block>();
     this.activeFigure = genFigure();
     this.preparedFigure = genFigure();
     this.pg.addFigure(activeFigure);
 }
示例#2
0
 internal void trashMe(Figure figure)
 {
     foreach (Block b in figure.blocks)
     {
         this.trash.AddLast(b);
     }
     this.activeFigure = this.preparedFigure;
     this.preparedFigure = genFigure();
     paintPrepFig(g2);
     this.pg.addFigure(this.activeFigure);
 }
示例#3
0
 internal void reset()
 {
     points = 0;
     time = 0;
     lvl = 10;
     end = false;
     hide = true;
     this.pg = new Playground(getMaxX(), getMaxY(), blocksize);
     this.trash = new LinkedList<Block>();
     this.activeFigure = genFigure();
     this.preparedFigure = genFigure();
     this.pg.addFigure(activeFigure);
 }
示例#4
0
 internal void notifyPosChange(Figure figure)
 {
     this.pg.updateFigure(figure);
 }
示例#5
0
 internal void updateFigure(Figure figure)
 {
     Block[] tmp = new Block[4];
     Array.Copy(figure.blocks, tmp, 4);
     Array.Sort(tmp, delegate(Block b1, Block b2)
     {
         return -b1.Y1.CompareTo(b2.Y1);
     });
     foreach (Block b in tmp)
     {
         updateBlock(b);
     }
 }
示例#6
0
 internal void addFigure(Figure activeFigure)
 {
     foreach (Block b in activeFigure.getBlocks())
     {
         addBlock(b);
     }
 }