TriangleHead
Member
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?
public bool CanAttack()
{
var target = (SharedGameObject)bt.GetVariable("Player"); // bt being the BehaviourTree component attached to my character
float dist = Vector3.Distance(transform.position, target.Value.transform.position);
return dist <= AttackDistance();
}