public List <GameObject> GetPath(Vector3 position, poiType type) { int startNode = FindNode(position); int endNode = FindEndNode(startNode, type); return(GetPath(startNode, endNode)); }
public PointOfInterest(GameObject _me, int _index, poiType _type, float _weight = 0) { me = _me; index = _index; visiblePoints = new List <int>(); position = me.transform.position; weight = _weight; type = _type; }
public int FindEndNode(int startNode, poiType type) { float minDistance = float.MaxValue; int endNode = 0; for (int i = 0; i < pointsOfInterest.Count; i++) { if (pointsOfInterest[i].type == type) { if (data[startNode][i].distanceList[i] < minDistance) { minDistance = data[startNode][i].distanceList[i]; endNode = i; } } } return(endNode); }
public void AddPoint(GameObject obj, poiType type = poiType.regular, float weight = 0) { pointsOfInterest.Add(new PointOfInterest(obj, pointsOfInterest.Count, type, weight)); CalculateVisiblity(pointsOfInterest.Count - 1); }
public List <GameObject> GetPath(int startNode, poiType type) { return(GetPath(startNode, FindEndNode(startNode, type))); }