コード例 #1
0
        public void ConnectedDoorsCanBeReplacedWithOtherTerrain()
        {
            //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.PlaceRoomTemplateAtPosition(room2, new Point(7, 8));

            bool corridorPlacement = mapGen.JoinDoorsWithCorridor(mapGen.PotentialDoors[0], mapGen.PotentialDoors[1], corridor1);

            mapGen.ReplaceConnectedDoorsWithTerrain(RoomTemplateTerrain.Floor);

            //Check the doors are floor when merged
            var map = mapBuilder.MergeTemplatesIntoMap(GetStandardTerrainMapping());

            Assert.AreEqual(MapTerrain.Empty, map.mapSquares[4, 3].Terrain);
            Assert.AreEqual(MapTerrain.Empty, map.mapSquares[8, 8].Terrain);
        }