示例#1
0
        public void CheckForCollisionsTest_Floating_Piece()
        {
            // Piece is not touching anything
            Block        anchor = new Block(3, 3);
            BlockGrid    grid   = new BlockGrid(6, 6);
            SquareShape  shape  = new SquareShape(anchor, defaultOri);
            List <Block> blocks = shape.blocks;

            Assert.AreEqual(false, MovementManager.CheckForCollisions(grid, blocks, shape));
        }
示例#2
0
        public void CheckForCollisionsTest_Bottom()
        {
            // block has reached the bottom
            Block        anchor = new Block(3, -1);
            BlockGrid    grid   = new BlockGrid(5, 5);
            SquareShape  shape  = new SquareShape(anchor, defaultOri);
            List <Block> blocks = shape.blocks;

            Assert.AreEqual(true, MovementManager.CheckForCollisions(grid, blocks, shape));
        }
示例#3
0
        public void CheckForCollisionsTest_Right_Bound()
        {
            // block that we are about to add exceeds max width
            Block        anchor = new Block(6, 3);
            BlockGrid    grid   = new BlockGrid(5, 5);
            SquareShape  shape  = new SquareShape(anchor, defaultOri);
            List <Block> blocks = shape.blocks;

            Assert.AreEqual(true, MovementManager.CheckForCollisions(grid, blocks, shape));
        }
示例#4
0
        public void CheckForCollisionsTest_Left_Bound()
        {
            // block that we are about to add crosses the left bound
            Block        anchor = new Block(-1, 4);
            BlockGrid    grid   = new BlockGrid(5, 5);
            SquareShape  shape  = new SquareShape(anchor, defaultOri);
            List <Block> blocks = shape.blocks;

            Assert.AreEqual(true, MovementManager.CheckForCollisions(grid, blocks, shape));
        }
示例#5
0
        public void CheckForCollisionsTest_Pieces_Touching()
        {
            Block     anchor        = new Block(3, 3);
            BlockGrid grid          = new BlockGrid(5, 5);
            GameShape existingShape = new SquareShape(anchor, defaultOri);

            // put an exisiting shape at the coordinate where we are placing a block
            grid.PlaceShape(existingShape);
            List <Block> blocks = existingShape.blocks;
            SquareShape  shape  = new SquareShape(anchor, defaultOri);

            Assert.AreEqual(true, MovementManager.CheckForCollisions(grid, blocks, shape));
        }