Пример #1
0
        public void EntirelyWalkableRoomIsConnected()
        {
            RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testfilling_walkable.room");
            var filler = new RoomFilling(roomTemplate);

            Assert.IsTrue(filler.Connected);
        }
Пример #2
0
        private static void AddStandardDecorativeFeaturesToRoom(int level, TemplatePositioned positionedRoom, int featuresToPlace, DecorationFeatureDetails.Decoration decorationDetails)
        {
            var bridgeRouter = new RoomFilling(positionedRoom.Room);

            var floorPoints = RoomTemplateUtilities.GetPointsInRoomWithTerrain(positionedRoom.Room, RoomTemplateTerrain.Floor);

            for (int i = 0; i < featuresToPlace; i++)
            {
                var randomPoint = floorPoints.RandomElement();
                floorPoints.Remove(randomPoint);

                if (bridgeRouter.SetSquareUnWalkableIfMaintainsConnectivity(randomPoint))
                {
                    var featureLocationInMapCoords = positionedRoom.Location + randomPoint;
                    Game.Dungeon.AddFeatureBlocking(new Features.StandardDecorativeFeature(decorationDetails.representation, decorationDetails.colour), level, featureLocationInMapCoords, true);

                    LogFile.Log.LogEntryDebug("Placing feature in room " + positionedRoom.RoomIndex + " at location " + featureLocationInMapCoords, LogDebugLevel.Medium);
                }

                if (floorPoints.Count() == 0)
                {
                    break;
                }
            }
        }
Пример #3
0
        public void PlacingABlockOffSideOfTemplateFails()
        {
            RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testrouting.room"); //8x4

            var filler = new RoomFilling(roomTemplate);

            filler.SetSquareUnwalkable(new Point(-1, -11));
            Assert.IsTrue(filler.Connected);
        }
Пример #4
0
        public void CompletelyBlockingDoorwayUsingCheckAndSetFunctionFails()
        {
            RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testrouting.room"); //8x4

            var filler = new RoomFilling(roomTemplate);

            filler.SetSquareUnWalkableIfMaintainsConnectivity(new Point(1, 1));

            Assert.IsFalse(filler.SetSquareUnWalkableIfMaintainsConnectivity(new Point(1, 2)));
        }
Пример #5
0
        public void CompletelyBlockingOffADoorwayFails()
        {
            RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testrouting.room"); //8x4

            var filler = new RoomFilling(roomTemplate);

            filler.SetSquareUnwalkable(new Point(1, 1));
            filler.SetSquareUnwalkable(new Point(1, 2));
            filler.SetSquareUnwalkable(new Point(1, 3));
            Assert.IsFalse(filler.Connected);
        }
Пример #6
0
        public void DividingRoomIntoTwoBreakingSomeConnectionsButLeavingAllDoorsWithOneRouteFails()
        {
            RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testrouting.room"); //8x4

            var filler = new RoomFilling(roomTemplate);

            filler.SetSquareUnwalkable(new Point(4, 1));
            filler.SetSquareUnwalkable(new Point(4, 2));
            filler.SetSquareUnwalkable(new Point(3, 2));
            filler.SetSquareUnwalkable(new Point(2, 2));
            filler.SetSquareUnwalkable(new Point(2, 1));

            Assert.IsFalse(filler.Connected);
        }
Пример #7
0
        public void RoomWithDiagonalGapConnectingWalkableAreasNotConnected()
        {
            RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testfilling_diagonalconnected.room");
            var filler = new RoomFilling(roomTemplate);

            Assert.IsFalse(filler.Connected);
        }
Пример #8
0
        public void TestPlacingABlockInCentreOfLargeRoomAllowsPathing()
        {
            RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testrouting.room"); //8x4

            var filler = new RoomFilling(roomTemplate);

            filler.SetSquareUnwalkable(new Point(3, 2));
            Assert.IsTrue(filler.Connected);
        }
Пример #9
0
        public void RoomWithPartialVerticalBarrierDividingWalkableAreasIsConnected()
        {
            RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testfilling_dividedgap_vert.room");
            var filler = new RoomFilling(roomTemplate);

            Assert.IsTrue(filler.Connected);
        }