Exemplo n.º 1
0
    private static void SetPathData(MapTile startTile, MapTile destinationTile)
    {
        for (int level = 0; level < g_map.SectorLevelNum; level++)
        {
            PathNode s = g_map.GetWayPointPathNode(level, startTile);
            if (s == null)
            {
                MapSector startNodeSector      = startTile.GetMapSector(level, g_map);
                PathNode  startMultiSectorNode = startNodeSector.CreateWayPointInSector(startTile, g_map);
                startNodeSector.CalcWayPointJoinNode(startMultiSectorNode, g_map);
                StartSectorNodes[level] = startMultiSectorNode;
            }
            else
            {
                StartSectorNodes[level] = s;
            }

            PathNode e = g_map.GetWayPointPathNode(level, destinationTile);
            if (e == null)
            {
                MapSector destinationNodeSector      = destinationTile.GetMapSector(level, g_map);
                PathNode  destinationMultiSectorNode = destinationNodeSector.CreateWayPointInSector(destinationTile, g_map);
                destinationNodeSector.CalcWayPointJoinNode(destinationMultiSectorNode, g_map);
                DestSectorNodes[level] = destinationMultiSectorNode;
            }
            else
            {
                DestSectorNodes[level] = e;
            }
        }
    }
Exemplo n.º 2
0
    public static void CreateGate(MapSector sector, Side edge, MapTile tile, MapSector neighbourSector, Side neighbourSectoredge, MapTile neighbourTile)
    {
        if (sector == null || neighbourSector == null || tile == null || neighbourTile == null)
        {
            return;
        }
        PathNode node          = sector.CreateWayPointInSector(tile, edge, g_Map);
        PathNode neighbourNode = neighbourSector.CreateWayPointInSector(neighbourTile, neighbourSectoredge, g_Map);

        node.LinkOtherSectorGate          = neighbourNode;
        neighbourNode.LinkOtherSectorGate = node;
        PathNode.LinkSectorNode(node, neighbourNode, 1, null);
    }