Пример #1
0
        public List <GameObject> GetPath(Vector3 position, poiType type)
        {
            int startNode = FindNode(position);
            int endNode   = FindEndNode(startNode, type);

            return(GetPath(startNode, endNode));
        }
Пример #2
0
 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;
 }
Пример #3
0
        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);
        }
Пример #4
0
 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);
 }
Пример #5
0
 public List <GameObject> GetPath(int startNode, poiType type)
 {
     return(GetPath(startNode, FindEndNode(startNode, type)));
 }