Пример #1
0
    private Vector3 ClosestTargetSide()
    {
        TargetPoint closestPoint = target.GetClosestTarget(transform);

        if (closestPoint == null)
        {
            closestPoint = lastTarget;
        }

        if (lastTarget != closestPoint)
        {
            target.DeleteTargetReference(lastTarget.targetPoint);
            lastTarget = closestPoint;
        }

        if (Vector3.Distance(closestPoint.targetPoint.position, transform.position) <= 0.3f)
        {
            return(Vector3.zero);
        }

        return(closestPoint.targetPoint.position);
    }