You might check the distance to the target (GetComponent<NavMeshAgent>().remainingDistance ) and compare it to an acceptance radius. Something smaller than the attack range, but larger than the NavMeshAgent’s radius.
I quite didn’t get where this should be applied to, though…
public class Mover : MonoBehaviour, IAction
{
[Tooltip("Keep this value between the NavMesh agent's radius and the weapon range")]
[SerializeField] private float acceptanceRadius = 1f;
void Update()
{
if (agent.remainingDistance < acceptanceRadius)
{
animator.SetFloat(LOCOMOTION_FORWARD_SPEED, 0);
}
UpdateAnimator();
}
Not really…
And something like
if (remainingDistance > acceptanceRadius)
{
UpdateAnimator();
}