Exemplo n.º 1
0
        /// <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;
            }
        }
Exemplo n.º 2
0
        public void DiamondLogic(Block block)
        {
            QueueBlockToBreak(block);
            Block otherBlock = block.GetBottomAdjacent();

            if (otherBlock != null)
            {
                QueueColor(otherBlock.data.color);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// width, 1 < y < height - 1
        /// </summary>
        private void FormRight()
        {
            int currentHeight = (data.height - 1);

            Block current = data.topRight;

            while (currentHeight > 1)
            {
                current = current.GetBottomAdjacent();
                current.SetSprite(BlockPosition.right);
                currentHeight--;
            }
        }