So theres a huge number of ways to approach the health thing..
The first thing I would try to see if works for your situation is:
- Put a collider on the weapon (a box or something should be fine).
- Put a collider on the enemy.
Now you can actually clash the weapon and the enemy.
- In your attack routine add a Collision Event (Action)
- Store Collider, thats the enemy you hit.
Now you have the clash info, so when you attacked and there was a hit the action will trigger and store the enemy you hit into a variable
Add a Send Event action, choose game object, specify game object, and choose that collider/enemy variable you just stored. On the enemy you can make a state that handles subtracting the health. Which is basically just Float Subtract locally and then a return to idle state for the health management FSM.