An alternative method

I did this another way with another Raycast.

When the Animation event is called the enemy does a short raycast of 3 units to see if it hit the players collider. If it did it tries to get a Health component out of it and if it does it calls the Take Damage method on it.

If this was an actual prototype something like this would also allow enemies to damage each other or objects that implement the Health class (or interface) without explicitly searching for a player health script on start up.

2 Likes

That’s an interesting idea and solution. Thanks for sharing! :slight_smile:

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms