Spent most of my (limited) development time today fixing a few bugs (being able to meelee with a crossbow and fire arrows at the same time etc.) but I also managed to get the beginning of the enemy animations in place. I'm using Unity's Mecanim system with my own Enemy A.I script (Which handles all types of A.I. in one script so I can easily change enemy behaviour at runtime!). Here's a quick rundown on how it works:
Enemies are default to playing the walking animation (which is automatically located by my script/Mecanim for each enemy) at half the speed of the actual animation, giving a nice walking effect! Every X amount of seconds (100 in-game ticks) the enemies will raycast straight forward from their location. A raycast is basically like an invisible laser pointer that returns information about what it hits back. If the hit object is tagged with "Player" then it will check the distance between the Enemy and Player, and if it is less than X metres (6 at the moment but I'm going to nerf it based on enemy statistics) then it deals damage to the player, plays the attack animation and the attack sound! If it is not with in range, the timer goes back to 100 ticks and it waits for the next countdown before trying the feature again!
It's a bit hard to get screenshots of the attacks, but I plan on making a video alongside the 3.0 release on Friday!
Keep on Coding!
No comments :
Post a Comment