Пример #1
0
    void GetDijkstraValues()
    {
        int endDijkstra = playerM.nearestNodIndex;

        List <int> disjkstraPath = PathFinding.Disjkstra(m, endIndex, endDijkstra);

        initIndex = endIndex;
        endIndex  = disjkstraPath[1];
    }
    void Start()
    {
        path2 = PathFinding.Disjkstra(graph, 0, 5);


        points.Add(GameObject.Find("p0").transform.position);
        points.Add(GameObject.Find("p1").transform.position);
        points.Add(GameObject.Find("p2").transform.position);
        points.Add(GameObject.Find("p3").transform.position);
        points.Add(GameObject.Find("p4").transform.position);
        points.Add(GameObject.Find("p5").transform.position);
    }
Пример #3
0
    void SetupEsquivando(PathGenerator pathG)
    {
        currentPathG = pathG;
        int myNearestNode = NodeNearestToTransform(transform);

        TargetNode = NodeNearestToTransform(GameController.GC.Player);
        path       = PathFinding.Disjkstra(currentPathG.graph, myNearestNode, TargetNode);

        pathCounter   = 0;
        currentTarget = pathG.waypoints[path[pathCounter]];

        KamiState = KAMI_STATE.ESQUIVANDO;
    }
Пример #4
0
    void Esquivando()
    {
        if (Vector3.Distance(transform.position, currentTarget) < minDistance)
        {
            int newTargetNode = NodeNearestToTransform(GameController.GC.Player);
            if (TargetNode != newTargetNode)
            {
                TargetNode  = newTargetNode;
                path        = PathFinding.Disjkstra(currentPathG.graph, path[pathCounter], TargetNode);
                pathCounter = 0;
            }

            if (pathCounter + 1 >= path.Count)
            {
                addSeek(GameController.GC.Player.position);
                KamiState = KAMI_STATE.LIBRE;
                return;
            }

            pathCounter++;
            currentTarget = currentPathG.waypoints[path[pathCounter]];
        }
        addSeek(currentTarget);
    }