Exemple #1
0
        public void GetHallTouchRangeLargeRoomMiddle(int fulfill1, int fulfill2, int rangeMin, int rangeMax)
        {
            string[] inGrid =
            {
                "A.A.A.0",
                ". . . .",
                "A.A.A.0",
                ". . . .",
                "0.0.0.0",
            };
            int width = 16;

            bool[] fulfillable = new bool[width];
            fulfillable[fulfill1] = true;
            fulfillable[fulfill2] = true;

            TestGridFloorPlan floorPlan = TestGridFloorPlan.InitGridToContext(inGrid, 6, 4);
            Mock <IRandom>    testRand  = new Mock <IRandom>(MockBehavior.Strict);
            TestGridRoomGen   testGen   = (TestGridRoomGen)floorPlan.PublicArrayRooms[0].RoomGen;

            testGen.PrepareSize(testRand.Object, new Loc(width, 6));
            testGen.PrepareFulfillableBorder(Dir4.Down, fulfillable);
            testGen.SetLoc(new Loc(2, 1));
            IntRange bounds        = floorPlan.GetHallTouchRange(testGen, Dir4.Down, 1);
            IntRange compareBounds = new IntRange(rangeMin, rangeMax);

            Assert.That(bounds, Is.EqualTo(compareBounds));
        }
Exemple #2
0
        public void GetHallTouchRangeLargeRoom(Dir4 dir, int tier, int rangeMin, int rangeMax)
        {
            // a room that takes up multiple cells
            string[] inGrid =
            {
                "A.A.0.0",
                ". . . .",
                "A.A.0.0",
                ". . . .",
                "A.A.0.0",
                ". . . .",
                "0.0.0.0",
            };

            TestGridFloorPlan floorPlan = TestGridFloorPlan.InitGridToContext(inGrid, 6, 4);
            Mock <IRandom>    testRand  = new Mock <IRandom>(MockBehavior.Strict);
            IRoomGen          testGen   = floorPlan.PublicArrayRooms[0].RoomGen;

            testGen.PrepareSize(testRand.Object, new Loc(5, 10));
            testGen.SetLoc(new Loc(1, 2));
            IntRange bounds        = floorPlan.GetHallTouchRange(testGen, dir, tier);
            IntRange compareBounds = new IntRange(rangeMin, rangeMax);

            Assert.That(bounds, Is.EqualTo(compareBounds));
        }