private void HandleDestinationAnimation(Transform target, IAbility ability) { if (target != null) { navMeshAgent.destination = target.position; float remainingDistance = Vector3.Distance(target.position, transform.position); if (remainingDistance >= ability.effectiveRange) { animController.AnimateAimChasing(); navMeshAgent.speed = navSpeedDefault; navMeshAgent.Resume(); } else if (remainingDistance >= ability.effectiveRange - chaseEpsilon) { animController.AnimateAimChasing(); navMeshAgent.speed = target.GetComponent <NavMeshAgent>().speed; navMeshAgent.Resume(); } else { animController.AnimateAimStanding(); navMeshAgent.speed = navSpeedDefault; navMeshAgent.Stop(); } } else { if (navMeshAgent.remainingDistance > navMeshAgent.stoppingDistance) { animController.AnimateMovement(animSpeed); //animController.AnimateMovement(navMeshAgent.velocity.magnitude/navMeshAgent.speed); for smooth walking } else { animController.AnimateIdle(); } } }