public Engine() { this.pg = new Playground(getMaxX(),getMaxY(),blocksize); this.trash = new LinkedList<Block>(); this.activeFigure = genFigure(); this.preparedFigure = genFigure(); this.pg.addFigure(activeFigure); }
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); }
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); }
internal void notifyPosChange(Figure figure) { this.pg.updateFigure(figure); }
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); } }
internal void addFigure(Figure activeFigure) { foreach (Block b in activeFigure.getBlocks()) { addBlock(b); } }