I have implemented IAttackAgent and the AttackDistance() is firing. But when the NPCs reach the target it just stands there and the Attack(Vector3 targetPosition) method is never fired. What can the problem be?
CanAttack will be called when the agent is within distance and can see the target. It depends on which task you are using but tacticalAgent.TryAttack calls CanAttack/Attack. I would place a breakpoint within the OnUpdate method of the tactical task that you are using to try to see what condition is returning false.
I have a similar problem but with the Shoot and Scoot task. Basically the agents travel to their target, stop and then do nothing else. From looking at the code, it appears the agents never reach their destination, therefore don't run the tacticalAgent.Tryattack call.
Further investigation reveals the problem to be with the NavMesh Agent Base Offset. Basically if you set it to 0 it then works, but any other value fails. Unfortunately this isn't really solution, as setting the base offset to 0 causes the agent to sink into the ground.
Do you know of a better solution to this problem, as I envisage this may cause problems with other tactical tasks.