public void GenerateGrapthArray()
        {
            for (int x = 0; x < bounds.size.x; x++)
            {
                for (int y = 0; y < bounds.size.y; y++)
                {
                    if (tile[x + y * bounds.size.x] == null)
                    {
                        continue;
                    }

                    if (Del(x, y, 2, 0) && Del(x, y, 0, 2) && Del(x, y, -2, 0) && Del(x, y, -2, -2))
                    {
                        if (tile[x + (y + 1) * bounds.size.x] == null)
                        {
                            myTile[x, y + 1] = new MyTile()
                            {
                                pos       = new Vector2(x + offset.x + tileOffset, (y + 1) + offset.y + tileOffset),
                                type      = MyTile.TileType.Hor,
                                tileCoord = new Vector2Int(x, y + 1)
                            };
                        }
                    }

                    if (Del(x, y, 2, 2) && Del(x, y, 2, 0) && Del(x, y, 0, 2) && Del(x, y, -2, 0) && Del(x, y, -2, -2))
                    {
                        if (tile[x + (y + 1) * bounds.size.x] == null &&
                            tile[(x + 1) + (y + 1) * bounds.size.x] == null &&
                            tile[(x + 1) + y * bounds.size.x] == null)
                        {
                            myTile[x + 1, y + 1] = new MyTile()
                            {
                                pos       = new Vector2((x + 1) + offset.x + tileOffset, (y + 1) + offset.y + tileOffset),
                                type      = MyTile.TileType.Angle,
                                tileCoord = new Vector2Int(x + 1, y + 1)
                            };
                        }
                    }

                    if (Del(x, y, 0, 2) && Del(x, y, -2, 0) && Del(x, y, -2, -2))
                    {
                        if (tile[x + (y + 1) * bounds.size.x] == null &&
                            tile[(x - 1) + (y + 1) * bounds.size.x] == null &&
                            tile[(x - 1) + y * bounds.size.x] == null)
                        {
                            myTile[x - 1, y + 1] = new MyTile()
                            {
                                pos       = new Vector2((x - 1) + offset.x + tileOffset, (y + 1) + offset.y + tileOffset),
                                type      = MyTile.TileType.Angle,
                                tileCoord = new Vector2Int(x - 1, y + 1)
                            };
                        }
                    }
                }
            }
        }
        public void SortNeighbors(MyTile myTile)
        {
            for (int i = 0; i < myTile.neighbors.Count - 2; i++)
            {
                for (int j = 0; j < myTile.neighbors.Count - 2; j++)
                {
                    if (myTile.neighbors[j].weight < myTile.neighbors[j + 1].weight)
                    {
                        continue;
                    }

                    Neighbors neighbor = myTile.neighbors[j + 1];
                    myTile.neighbors[j + 1] = myTile.neighbors[j];
                    myTile.neighbors[j]     = neighbor;
                }
            }
        }
 public Neighbors(MyTile neighbor, int weight)
 {
     this.neighbor = neighbor;
     this.weight   = weight;
 }