Gameplay.Unit.Movement.PathAgentController.SetDestination C# (CSharp) Method

SetDestination() public method

public SetDestination ( Vector3 targetDestination ) : void
targetDestination Vector3
return void
        public void SetDestination(Vector3 targetDestination)
        {
            NavMeshHit navMeshHit;
            NavMesh.SamplePosition(targetDestination, out navMeshHit, 2.0f, areaMask);

            if (!navMeshHit.hit)
                return;

            reachDestination = false;

            startPosition = navMeshHit.position;
            navMeshAgent.SetDestination(navMeshHit.position);

            if (checkDestination != null)
            {
                StopCoroutine(checkDestination);
                checkDestination = null;
            }

            checkDestination = StartCoroutine(CheckDestination());
        }