I created a slightly more complex attack system that uses scores for various attacks giving higher score attacks a greater chance of occuring. I also gave enemy attacks a cooldown. This adds a bit of variability to an AIs attack and it also checks if the player is in the right angle for the attack, meaning it won’t try to use the attack if the player is behind. Each attack can be individualized to have a specific range and angle. The AI can also rotate to a certain degree during their attack animation, I feel like this gives them a bit more life when they swing instead of being frozen in one direction during the whole animation and you can really tweek this to your hearts content. I might add a force applier too, similar to the player, for some of my animations that involve essentially root motion movement however we don’t use root motion so those animations sometimes look silly when their is no actual movement… I don’t think it would be hard at all to add since we already did it for the player.
Oh, you can also specify what damage collider you want for each attack, so you can have multiple different colliders, maybe for a big AoE attack around the enemy that you can turn on and off, instead of just one that is attached to a weapon. This is why my script is also called “AttackHandler” instead of having a weapon handler, because its handling the cooldown times and which collider should be activated as well as how much damage it should do when it collides.
This is a screenshot of my skeleton enemies inspector and you can see these settings here.
Anyway, I just wanted to show off some of the changes i made. Hopefully it doesn’t make the series to difficult to follow along with.