Node 2 => Can See Object, is searching for: Target, (Target is a variable)
Node 3 => Pursue, is searching for: Target, and the Arrived Distance is 2
Node 5 => Set Animator Trigger, is only to play an animation in my animator controller, it is not obligatory.
Node 7 => Can See Object, is searching for target, The distance that the agent can view is 2, and the condition is inverted (not see object). (The condition will be completed when the enemy is not looking at the target, inside the field of view)
Node 8 => Can See Object, is searching for target and, The distance that the agent can view is 2.
The enemy starts wandering (node 1 => Wander), when it looks at the target (node 2 => Can See Object), it starts pursuing the target (node 3 => Pursue ), when it arrived (node 4 => Wait for Finish ), play an attack animation (node 5 => Animation Set trigger ) and now it check if it the enemy is not looking at the target closely (node 7 => Can See Object ) (start again node 9 => Start Again) wandering , and if the enemy is looking at the target closely (node 8 => Can See Object ) attack again (node 5) , Node 6 => Running
WARNING: You have to set the variable “Target” in the right side of the screen