예제 #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;
            }
        }
예제 #2
0
        /// <summary>
        /// 1, 1 < x < height
        /// </summary>
        private void FormLeft()
        {
            int currentHeight = 1;

            Block current = data.bottomLeft;

            while (currentHeight < (data.height - 1))
            {
                current = current.GetTopAdjacent();
                current.SetSprite(BlockPosition.left);
                currentHeight++;
            }
        }