Exemple #1
0
 public void Construct(IMapRoomFactory mapRoomFactory,
                       IMapDataFactory mapDataFactory,
                       IHallwayFactory hallwayFactory,
                       IPhysicalMapRoomFactory physMapRoomFactory,
                       IMapRoomTools mapRoomTools,
                       IPointTriangulation pointTriangulation)
 {
     this.mapRoomFactory     = mapRoomFactory;
     this.mapDataFactory     = mapDataFactory;
     this.hallwayFactory     = hallwayFactory;
     this.physMapRoomFactory = physMapRoomFactory;
     this.mapRoomTools       = mapRoomTools;
     this.pointTriangulation = pointTriangulation;
 }
Exemple #2
0
        public MapData CreateNewMapData(List <MapRoom> hubRooms, List <MapRoom> hallwayRooms, List <Line> hallwayLines, IMapRoomFactory mapRoomFactory)
        {
            Point bottomLeftPoint = FindBottomLeftPointInMap(hubRooms, hallwayRooms, hallwayLines);
            Point upperRightPoint = FindUpperRightPointInMap(hubRooms, hallwayRooms, hallwayLines);

            hubRooms     = OffSetRoomsToZeroOrigin(hubRooms, bottomLeftPoint);
            hallwayRooms = OffSetRoomsToZeroOrigin(hallwayRooms, bottomLeftPoint);
            hallwayLines = OffsetLinesToZeroOrigin(hallwayLines, bottomLeftPoint);

            int width  = upperRightPoint.X - bottomLeftPoint.X;
            int height = upperRightPoint.Y - bottomLeftPoint.Y;

            RoomType[][] map = CreateMap(width, height);

            map = AddRoomsToMap(hubRooms, map);
            map = AddRoomsToMap(hallwayRooms, map);
            map = AddLinesToMap(hallwayLines, map);

            List <MapRoom> fillerRooms = mapRoomFactory.CreateRoomsFromFiller(map);

            map = AddRoomsToMap(fillerRooms, map);

            return(new MapData(map, hubRooms, hallwayRooms, fillerRooms, hallwayLines, width, height));
        }