public DungeonGraphConnection(DungeonGraphNode a, DungeonGraphNode b, Doorway doorwayA, Doorway doorwayB)
        {
            A        = a;
            B        = b;
            DoorwayA = doorwayA;
            DoorwayB = doorwayB;

            a.AddConnection(this);
            b.AddConnection(this);
        }
示例#2
0
        public DungeonGraph(Dungeon dungeon)
        {
            Dictionary <Tile, DungeonGraphNode> nodeMap = new Dictionary <Tile, DungeonGraphNode>();

            foreach (var tile in dungeon.AllTiles)
            {
                var node = new DungeonGraphNode(tile);
                nodeMap[tile] = node;
                Nodes.Add(node);
            }

            foreach (var conn in dungeon.Connections)
            {
                var nodeConn = new DungeonGraphConnection(nodeMap[conn.A.Tile], nodeMap[conn.B.Tile], conn.A, conn.B);
                Connections.Add(nodeConn);
            }
        }