Thursday, 4 May 2017

Outside the Box Project Beta Work - Enemy Health and Damage Calculation

I conceptualised how to operate both the EnemyHealth and Damage calculations within 1 script for reduced work on the hardware/software on a sticky note one night.


Enemy Health and Damage Calculations:


I decided to have the damage calculations of the Defences be controlled by the Enemy's own Health Manager Script. The enemies would need a collider regardless to check when they are hit with a Bullet, so using the collider of the Bullet the EnemyHealthManager checks the Tag of the Bullet GameObject and portions damaged based on the collision.
What this means is there is a smoother control of Damage calculation on the Enemy Health but, more crucially, the Defences do not become more powerful per hit when they are upgrade, their damage per second (DPS) is increased by virtue of shooting faster when the Defences are upgraded.

If I wanted to, at a later date, I could have the Bullets check for the Collider and Tag of the Enemy when the bullet Collides with a Box Collider and then, deal more damage, by having the Bullet themselves access the currentHealthValue through the Colliders and just reducing the value by an additional number. That way I could control the damage of the Bullets to be greater when they are upgraded.

Enemy Health Bar Functionality:


I invoke repeating in update as the DecreaseHealth function needs to repeatedly run it's calculations to provide accurate Health values and Health Bar scaling to the Player as feedback of their progress in killing the Enemies.

No comments:

Post a Comment