Esempio n. 1
0
    /// <summary>
    /// 构建扇区某条边的gate
    /// </summary>
    /// <param name="map"></param>
    public override void BuildOneEdgeGate(Side edge, Map map)
    {
        // 获取邻居扇区
        Side      neighbourEdge = Util.FlipDirection(edge);
        MapSector ms            = Findneighbour(edge, map);

        if (ms == null)
        {
            return;
        }
        if (edge == Side.Top)
        {
            SectorHelp.RebuildNodesOnSectorEdge(this, edge, new IntVector2(this.left, this.top),
                                                ms, neighbourEdge, new IntVector2(this.left, this.top - 1),
                                                IntVector2.right);
        }
        else if (edge == Side.Down)
        {
            SectorHelp.RebuildNodesOnSectorEdge(this, edge, new IntVector2(this.left, this.bottom),
                                                ms, neighbourEdge, new IntVector2(this.left, this.bottom + 1),
                                                IntVector2.right);
        }
        else if (edge == Side.Left)
        {
            SectorHelp.RebuildNodesOnSectorEdge(this, edge, new IntVector2(this.left, this.top),
                                                ms, neighbourEdge, new IntVector2(this.left - 1, this.top),
                                                IntVector2.down);
        }
        else if (edge == Side.Right)
        {
            SectorHelp.RebuildNodesOnSectorEdge(this, edge, new IntVector2(this.right, this.top),
                                                ms, neighbourEdge, new IntVector2(this.right + 1, this.top),
                                                IntVector2.down);
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 构建扇区某条边的gate
    /// </summary>
    /// <param name="map"></param>
    public override void BuildOneEdgeGate(Side edge, Map map)
    {
        // 获取邻居扇区
        Side      neighbourEdge = Util.FlipDirection(edge);
        MapSector ms            = Findneighbour(edge, map);

        if (ms == null)
        {
            return;
        }
        List <MapSector> listChild = map.GetChildSector(this);

        if (listChild == null || listChild.Count == 0)
        {
            return;
        }

        foreach (MapSector lowerSector in listChild)
        {
            // 先判断父子扇区在指定的边是否匹配,核心目的是为了得到父扇区的边。
            if (SectorHelp.LowerSectorEdgeMatchesHigher(this, lowerSector, edge)) // match edge
            {
                List <PathNode> listPathNode = lowerSector.GetPathNodeInEdge(edge);
                foreach (PathNode node in listPathNode) // get nodes to copy from the edge
                {
                    SectorHelp.CreateGate(this, edge, node.tileConnection, ms, neighbourEdge, node.LinkOtherSectorGate.tileConnection);
                }
            }
        }
    }
Esempio n. 3
0
 private void InitAPI()
 {
     TileHelp.Init(this);
     SectorHelp.Init(this);
     AStar.Init(this);
     FlowField.Init(this);
     JumpFlowFiled.Init(this);
     IggPathFinder.Init(this);
     MapChangeManger.Init(this);
 }