Ejemplo n.º 1
0
        public void VerticalSplitBottomXMaxInsideRect()
        {
            var rand     = new System.Random();
            var rootNode = new Stealcase.Generators.Procedural.BSP.Node(new RectInt(new Vector2Int(0, 0), new Vector2Int(10, 10)), 0, null, 0, 3, 5, 2, 0, rand);
            var tup      = rootNode.SplitVertically();
            var bottom   = tup.Item1;
            var top      = tup.Item2;

            Assert.AreEqual(rootNode.Rect.xMax, top.xMax);
        }
Ejemplo n.º 2
0
        public void VerticalSplitBottomMinInsideNode()
        {
            var rand     = new System.Random();
            var rootNode = new Stealcase.Generators.Procedural.BSP.Node(new RectInt(new Vector2Int(0, 0), new Vector2Int(10, 10)), 0, null, 0, 3, 5, 2, 0, rand);
            var tup      = rootNode.SplitVertically();
            var bottom   = tup.Item1;
            var top      = tup.Item2;

            Assert.IsTrue(rootNode.Rect.Contains(bottom.min));
        }
Ejemplo n.º 3
0
        public void VerticalSplitBothRoomsBiggerThanMinSize()
        {
            var rand     = new System.Random();
            var minSize  = 3;
            var rootNode = new Stealcase.Generators.Procedural.BSP.Node(new RectInt(new Vector2Int(0, 0), new Vector2Int(10, 10)), 0, null, 0, minSize, 5, 2, 0, rand);
            var tup      = rootNode.SplitVertically();
            var bottom   = tup.Item1;
            var top      = tup.Item2;

            Assert.IsTrue(bottom.width >= minSize && top.width >= minSize && bottom.height >= minSize && top.height > minSize);
        }