Beispiel #1
0
        public void CluesCanBePlacedInRoomIfOnlyOneRoomPossible()
        {
            ConnectivityMap newMap = new ConnectivityMap();

            newMap.AddRoomConnection(1, 2);

            var mapNoCycles = new MapCycleReducer(newMap.RoomConnectionGraph.Edges);
            var mapMST      = new MapMST(mapNoCycles.mapNoCycles.Edges);
            var manager     = new DoorAndClueManager(mapNoCycles, 1);

            Assert.IsNotNull(manager.PlaceDoorAndClue(new DoorRequirements(new Connection(1, 2), "lock0"), 1));
        }
Beispiel #2
0
        /// <summary>
        /// Constructed with the inputMap and the room id of the PC start location
        /// </summary>
        /// <param name="inputMap"></param>
        /// <param name="startVertex"></param>
        public MapModel(ConnectivityMap inputMap, int startVertex)
        {
            this.inputMap = inputMap;

            baseGraph        = new UndirectedGraph <int, TaggedEdge <int, string> >();
            this.startVertex = startVertex;

            //Clone the input graph (edges only)
            baseGraph.AddVerticesAndEdgeRange(inputMap.RoomConnectionGraph.Edges);

            //Build cycle-free map
            graphNoCycles = new MapCycleReducer(baseGraph.Edges);

            //Build Door and Clue Manager
            //Ensure we pass on the mapped (to no cycles) version of the start vertex
            doorAndClueManager = new DoorAndClueManager(graphNoCycles, graphNoCycles.roomMappingFullToNoCycleMap[startVertex]);

            //Build a random generator (don't keep instantiating them, because they all give the same number if during the same tick!
            random = new Random();
        }