PawnController.MoveToInternal C# (CSharp) Méthode

MoveToInternal() private méthode

private MoveToInternal ( Vector2 target2D, ContinueWith nextFn ) : void
target2D Vector2
nextFn ContinueWith
Résultat void
    private void MoveToInternal(Vector2 target2D, ContinueWith nextFn)
    {
        Vector3 target = new Vector3(target2D.x, target2D.y, gameObject.transform.position.z);
        target.y += DestinationOffsetY;

        currentRemainingDistance = Vector3.Distance(gameObject.transform.position, target);

        if (currentRemainingDistance <= DestinationDelta)
        {
            nextFn();
            return;
        }

        currentTarget = target;
        currentContinue = nextFn;
        currentDirection = new Vector3(target.x, target.y, gameObject.transform.position.z) - gameObject.transform.position;

        // ReSharper disable once CompareOfFloatsByEqualityOperator
        if (currentDirection.x != 0)
            SetNewFacing(currentDirection.x < 0 ? Facing.Left : Facing.Right);

        currentDirection.Normalize();
        if (!isMoving)
        {
            animator.SetTrigger("WalkStart");
            isMoving = true;
            StartCoroutine(playSteps());
        }
    }