Example #1
0
    protected void WalkOnPath()
    {
        if (currentPoint == null)
        {
            FindNearestPoint();
            return;
        }

        float distanceToPoint = (transform.position - currentPoint.transform.position).magnitude;

        if (distanceToPoint <= REACH_DISTANCE)
        {
            Transform newPoint = patrolPath.GetNextPoint(currentPoint);
            SetNewPoint(newPoint);
        }
    }