void GetFarestPoint(Vector2 _startPoint) { int maxInMax = 0; countOfMaxLength = 0; for (int i = 0; i < map.GetLength(0); i++) { for (int j = 0; j < map.GetLength(1); j++) { if (map[i, j] == 1) { allPoints++; } findLongestPath(map, visited, (int)startPoint.x, (int)startPoint.y, i, j, 0); PointLength pl = new PointLength { coordinates = new Vector2(i, j), lengthTo = _max_dist }; maxLengthToPoints.Add(pl); _max_dist = 0; } } for (int j = 0; j < maxLengthToPoints.Count; j++) { if (maxLengthToPoints[j].lengthTo > maxInMax) { endPoint = maxLengthToPoints[j].coordinates; maxInMax = maxLengthToPoints[j].lengthTo; } } for (int k = 0; k < maxLengthToPoints.Count; k++) { if (maxLengthToPoints[k].lengthTo == maxInMax) { countOfMaxLength++; } } //Debug.Log("Amount of max " + countOfMaxLength); //Debug.Log("End point is " + endPoint); }
public ComboPoint(float f, PointLength pl) { startPosition = f; length = pl; }