public ControlBlocks Execute(ControlBlocks controlBlocks)
    {
        var newControlBlocks = controlBlocks.Clone();

        newControlBlocks.LeftSpin();

        return(Adjuster.AdjustBlocksForSpin(controlBlocks, newControlBlocks));
    }
예제 #2
0
        public void クローンオブジェクト生成メソッドのテスト()
        {
            var controlBlocks  = new ControlBlocks(5, 10, IBlocks);
            var controlBlocks2 = controlBlocks.Clone();

            controlBlocks2.MoveDown();
            var controlBlocks3 = controlBlocks.Clone();

            controlBlocks3.MoveRight();

            Assert.AreEqual(5, controlBlocks.X);
            Assert.AreEqual(10, controlBlocks.Y);
            Assert.AreEqual(5, controlBlocks2.X);
            Assert.AreEqual(9, controlBlocks2.Y);
            Assert.AreEqual(6, controlBlocks3.X);
            Assert.AreEqual(10, controlBlocks3.Y);
        }
    public ControlBlocks Execute(ControlBlocks controlBlocks)
    {
        var newControlBlocks = controlBlocks.Clone();

        newControlBlocks.MoveRight();

        if (CollisionDetection.IsCollision(newControlBlocks))
        {
            ControlBlocksPresenter.PlayCollisionSound();
            return(controlBlocks);
        }
        return(newControlBlocks);
    }