public void EntirelyWalkableRoomIsConnected() { RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testfilling_walkable.room"); var filler = new RoomFilling(roomTemplate); Assert.IsTrue(filler.Connected); }
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; } } }
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); }
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))); }
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); }
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); }
public void RoomWithDiagonalGapConnectingWalkableAreasNotConnected() { RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testfilling_diagonalconnected.room"); var filler = new RoomFilling(roomTemplate); Assert.IsFalse(filler.Connected); }
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); }
public void RoomWithPartialVerticalBarrierDividingWalkableAreasIsConnected() { RoomTemplate roomTemplate = LoadTemplateFromAssemblyFile("DDRogueTest.testdata.vaults.testfilling_dividedgap_vert.room"); var filler = new RoomFilling(roomTemplate); Assert.IsTrue(filler.Connected); }