/// <summary> /// Check if block in direction is same color and break it /// </summary> /// <param name="block"></param> /// <param name="dir"></param> public void CheckBreak(Block block, Direction dir) { Block other; switch (dir) { case Direction.up: other = block.GetTopAdjacent(); CompareAndBreak(block, other, dir); break; case Direction.right: other = block.GetRightAdjacent(); CompareAndBreak(block, other, dir); break; case Direction.down: other = block.GetBottomAdjacent(); CompareAndBreak(block, other, dir); break; case Direction.left: other = block.GetLeftAdjacent(); CompareAndBreak(block, other, dir); break; default: break; } }
/// <summary> /// 1 < x < width - 1, height /// </summary> private void FormTop() { int currentWidth = (data.width - 1); Block current = data.topRight; while (currentWidth > 1) { current = current.GetLeftAdjacent(); current.SetSprite(BlockPosition.top); currentWidth--; } }