Example #1
0
        protected void RotationBlock()
        {
            int[,] block = _block.BlockCreate(_block.BlockNum, _block.RotationNum + 1);

            if (CanMoveBlock(block, _currentY, _currentX))
            {
                RotationBlockAction();
            }
            else if (_currentX < 0 || _currentX + block.GetLength(0) > WIDTH)
            {
                int currentX = _currentX < 0 ? 0 : WIDTH - block.GetLength(0);
                if (CanMoveBlock(block, _currentY, currentX))
                {
                    _currentX = currentX;
                    RotationBlockAction();
                }
            }

            void RotationBlockAction()
            {
                _block.SetRotationBlock();
                ReDrawBlock();
            }
        }