It’s kinda weird that the combat system isn’t completed yet at this point, I should have done this earlier, at least before spending time on audio and FX.
So the combat system was only partly implemented, the player could throw the shuriken and damage the enemy, but that’s all about it. The enemies would play attack animation, but there wasn’t any logic that damage the player in anyway. The range attack didn’t even have a projectile.
First of all, I’ve added a collider to the melee weapon, which will be activated when the attack animation is being played, and deactivated when the attack animation is finished. When player collides with the weapon collider, a health point will be deducted.
I’ve also made that after the player is being damaged, the player will be rendered invulnerable for a short amount of time. This should avoid the player from being damaged multiple times by the same attack, while the player will also stands a chance from multiple attacks.
The range weapon is implemented in a similar manner, the only difference is that the weapon is single-use only, and every time the enemy range-attacks, a new range weapon will be spawn on the hand. One interesting mechanic I implemented is that the player can shoot down the projectile from enemy.