// Update is called once per frame
        void Update()
        {
            if (!NodeManager.instance._initialized)
            {
                return;
            }

            if (!recalculatePath)
            {
                return;
            }

            tempTarg = Target;
            PathingManager.FindPath(gameObject.transform.position, tempTarg);
            recalculatePath = false;

            //// Dosnt work just yet
            //if (NodeManager.instance.nodes.Count > 0)
            //{
            //    for (int i = 0; i < NodeManager.instance.nodes.Count; i++)
            //    {
            //        while (Vector3.Distance(transform.position, NodeManager.instance.nodes[i].node.spacialInfo) > 0.5f)
            //        {
            //            transform.position = Vector3.Lerp(transform.position, NodeManager.instance.nodes[i].node.spacialInfo, 0.5f);
            //        }
            //    }
            //}
        }
示例#2
0
        void AssignPath()
        {
            if (!needPath || agentPath == null)
            {
                return;
            }

            needPath  = false;
            agentPath = PathingManager.FindPath(gameObject.transform.position, destination);
            path      = new Vector3[agentPath.Count + 1];
            for (int i = 0; i < agentPath.Count; i++)
            {
                path[i] = agentPath[i].node.spacialInfo;
            }
            CheckPoint();
        }