コード例 #1
0
        public void 右移動テスト()
        {
            var controlBlocks = new ControlBlocks(4, 14, IBlocks);

            controlBlocks.MoveRight();
            Assert.AreEqual(5, controlBlocks.X);
        }
コード例 #2
0
    private ControlBlocks AdjustBlocksForSpinLoop(ControlBlocks controlBlocks)
    {
        for (var i = 0; i <= controlBlocks.Blocks.BlockList.Count; i++)
        {
            if (CollisionDetection.IsCollisionControlBlocksLeftSide(controlBlocks))
            {
                controlBlocks.MoveRight();
                continue;
            }

            if (CollisionDetection.IsCollisionControlBlocksRightSide(controlBlocks))
            {
                controlBlocks.MoveLeft();
                continue;
            }

            if (CollisionDetection.IsCollisionControlBlocksLower(controlBlocks))
            {
                controlBlocks.MoveUp();
                continue;
            }

            break;
        }

        return(controlBlocks);
    }