Exemple #1
0
        public void Solve_WhenGivenCollidingPlantPart_ShouldSolvePlantPart()
        {
            var a = CellCreationHelper.CreateCell(100, 0, 0, 0);
            var b = CellCreationHelper.CreateCell(100, 200 * 1.5f, 0, 0);
            var c = CellCreationHelper.CreateCell(100, 100 * 1.5f, 0, (float)Math.Sqrt(3) * 100 / 2);

            Assert.True(a != b);
        }
        public void ResizeWHeight_WhenGivenNoneCollidingHeight_ShouldNotBeChanged()
        {
            var a = CellCreationHelper.CreateCell(10, 0, 11, 0, true);
            var b = CellCreationHelper.CreateCell(10, 15, 0, 15, true);

            cellSizer.ResizeHeight(a, b);

            Assert.AreEqual(11, a.Geometry.BottomCenter.Y, 0.00001);
            Assert.AreEqual(21, a.Geometry.TopCenter.Y, 0.00001);
        }
        public void ResizeWidth_WhenGivenFaceCollidingCell_ShouldNotBeCollidingAfterResize()
        {
            var a = CellCreationHelper.CreateCell(10, 0, 0, 0, true);
            var b = CellCreationHelper.CreateCell(10, 2.5f, 0, 2.5f, true);

            Assert.True(collisionDetection.Colliding(a, b, true), "Cells does not collide from the start");

            cellSizer.ResizeWidth(a, b);

            Assert.False(collisionDetection.Colliding(a, b, true), "Cells still collide after resizing");
        }
        public void ResizeWidth_WhenGivenFaceNotCollidingCell_ShouldNotBeChanged()
        {
            var a = CellCreationHelper.CreateCell(10, 0, 0, 0, true);
            var b = CellCreationHelper.CreateCell(10, 15, 0, 15, true);

            Assert.False(collisionDetection.Colliding(a, b, true), "Cells does collide from the start");

            cellSizer.ResizeWidth(a, b);

            Assert.False(collisionDetection.Colliding(a, b, true), "Cells collide after resizing");

            Assert.AreEqual(a.Geometry.BottomCenter, new Vector3(0, 0, 0));
            Assert.AreEqual(b.Geometry.BottomCenter, new Vector3(15, 0, 15));
        }