public void ConnectingDoorsBetweenTwoRoomsAlignedWithACorridorCanBeIdentified() { //Load sample template 8x4 RoomTemplate room1 = LoadTemplateFromFile("DDRogueTest.testdata.vaults.testalignmentroom1.room"); RoomTemplate room2 = LoadTemplateFromFile("DDRogueTest.testdata.vaults.testalignmentroom2.room"); RoomTemplate corridor1 = LoadTemplateFromFileRogueBasin("RogueBasin.bin.Debug.vaults.corridortemplate3x1.room"); TemplatedMapBuilder mapBuilder = new TemplatedMapBuilder(); TemplatedMapGenerator mapGen = new TemplatedMapGenerator(mapBuilder); mapGen.PlaceRoomTemplateAtPosition(room1, new Point(0, 0)); mapGen.PlaceRoomTemplateAlignedWithExistingDoor(room2, corridor1, mapGen.PotentialDoors[0], 0, 5); var room1ToCorridorDoor = mapGen.GetDoorForConnection(new Connection(0, 2)); var room2ToCorridorDoor = mapGen.GetDoorForConnection(new Connection(1, 2)); Assert.AreEqual(new Point(4, 3), room1ToCorridorDoor.MapCoords); Assert.AreEqual(new Point(4, 8), room2ToCorridorDoor.MapCoords); }
public void ConnectingDoorsBetweenTwoRoomsJoinedWithACorridorButAdjacentCanBeIdentified() { //Load sample template 8x4 RoomTemplate room1 = LoadTemplateFromFile("DDRogueTest.testdata.vaults.testalignmentroom3.room"); RoomTemplate room2 = LoadTemplateFromFile("DDRogueTest.testdata.vaults.testalignmentroom4.room"); RoomTemplate corridor1 = LoadTemplateFromFileRogueBasin("RogueBasin.bin.Debug.vaults.corridortemplate3x1.room"); TemplatedMapBuilder mapBuilder = new TemplatedMapBuilder(); TemplatedMapGenerator mapGen = new TemplatedMapGenerator(mapBuilder); mapGen.PlaceRoomTemplateAtPosition(room1, new Point(0, 0)); mapGen.PlaceRoomTemplateAtPosition(room2, new Point(-7, 1)); bool corridorPlacement = mapGen.JoinDoorsWithCorridor(mapGen.PotentialDoors[0], mapGen.PotentialDoors[1], corridor1); var room1ToRoom2Door = mapGen.GetDoorForConnection(new Connection(0, 1)); Assert.AreEqual(new Point(0, 2), room1ToRoom2Door.MapCoords); }