示例#1
0
    public void checkReachedNode()//Check if reached next Pathnode
    {
        Vector3 curDestination = GetComponent <CorvoPathFinder>().getDestination();

        //if (GetComponent<CorvoPathFinder>().getDestination().Equals(transform.position) )
        if (Vector3Util.IsXZAlmostEquals(transform.position, curDestination))
        {
            if (Mathf.Abs(transform.position.y - curDestination.y) < 0.1f)
            {
                GetComponent <CorvoPathFinder>().nextNode();
            }
        }

        //was last node?
        if (GetComponent <CorvoPathFinder>().foundPath == null)
        {
            if (Vector3Util.IsXZAlmostEquals(transform.position, destination))
            {
                stop();
            }
            else
            {
                //not arrived yet
                updatePath();
            }
        }
    }