Пример #1
0
    //returns force needed to go after the current target node
    private Vector2 pathFollowing()
    {
        target = new Vector2();

        if (path != null)
        {
            List <Vector3> nodes = path.getNodes();

            target = (Vector2)nodes[currentNode];

            if (Global.findVectorDist(this.transform.position, target) <= precisionRadius)   //reach dest

            {
                currentNode += 1;

                if (currentNode >= nodes.Count)
                {
                    currentNode = 0; //restart
                }
            }
        }

        return(seek(target));
    }