//寻路算法
    bool FindPaths()
    {
        foreach (GameTile tile in tiles)
        {
            if (tile.Content.Type == GameTileContentType.Destination)
            {
                tile.BecomeDestination();
                searchFrontier.Enqueue(tile);
            }
            else
            {
                tile.ClearPath();
            }
        }

        if (searchFrontier.Count == 0)
        {
            return(false);
        }


        // //设置目标位置
        // tiles[tiles.Length / 2].BecomeDestination();
        // searchFrontier.Enqueue(tiles[tiles.Length / 2]);



        //获取每个tile的上下左右位置,累计与初始点的距离,并记录与初始点朝向
        //注意,这里计算寻路是根据终点的位置来计算的(具体的画图理解...)
        while (searchFrontier.Count > 0)
        {
            GameTile tile = searchFrontier.Dequeue();
            if (tile != null)
            {
                //正常朝向
                // searchFrontier.Enqueue(tile.GrowPathUp());
                // searchFrontier.Enqueue(tile.GrowPathBottom());
                // searchFrontier.Enqueue(tile.GrowPathLeft());
                // searchFrontier.Enqueue(tile.GrowPathRight());

                //交叉朝向
                if (tile.IsAlternative)
                {
                    searchFrontier.Enqueue(tile.GrowPathUp());
                    searchFrontier.Enqueue(tile.GrowPathBottom());
                    searchFrontier.Enqueue(tile.GrowPathLeft());
                    searchFrontier.Enqueue(tile.GrowPathRight());
                }
                else
                {
                    searchFrontier.Enqueue(tile.GrowPathRight());
                    searchFrontier.Enqueue(tile.GrowPathLeft());
                    searchFrontier.Enqueue(tile.GrowPathBottom());
                    searchFrontier.Enqueue(tile.GrowPathUp());
                }
            }
        }

        foreach (var tile in tiles)
        {
            if (!tile.HashPath)
            {
                return(false);
            }
        }

        if (showPaths)
        {
            foreach (GameTile tile in tiles)
            {
                tile.ShowPath();
            }
        }

        return(true);
    }