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

CheckDestination() private method

private CheckDestination ( ) : IEnumerator
return IEnumerator
        private IEnumerator CheckDestination()
        {
            while (!reachDestination)
            {
                if(!enabled)
                    continue;

                if (!navMeshAgent.pathPending)
                {
                    if (navMeshAgent.remainingDistance <= navMeshAgent.stoppingDistance)
                    {
                        if (navMeshAgent.pathStatus == NavMeshPathStatus.PathComplete)
                        {
                            if (!navMeshAgent.hasPath || Mathf.Abs(navMeshAgent.velocity.sqrMagnitude) < float.Epsilon)
                            {
                                reachDestination = true;

                                destinationPosition = transform.position;
                                DispatchReachPosition();
                            }
                        }
                        else
                        {
                            reachDestination = true;

                            DispatchFail();
                        }
                    }
                }
                yield return new WaitForSeconds(0.1f);
            }
        }