Thursday, 4 May 2017

Outside the Box Project Beta Work - Enemy Health Regeneration Script


I made this script as a way to create an interesting Enemy variation in The Hunter, I decided against this in the end for 2 reasons. First, I didn't manage to get this script to work properly. Second, through testing we found that The Hunter was enough of a variation in itself due to it's significant difference in silhouette from The Grunt, The Hunter's reduced health (3 as opposed to The Grunt's 6) and due to The Hunter's increased speed, implemented because The Hunter has a more complicated path to follow than The Grunt.


The way this script was supposed to work was by accessing the m_EnemyHealthManagerScript component on the same gameObject as this script, The Hunter (this Heath Regeneration script being on The Hunter itself).
With access to The Hunter's contextual health values I would increase (+=) the float value by 1 in Update every second (Time.deltaTime).
I didn't manage to figure out how to fix this script, however as stated prior, fixing this script didn't matter in the end. But this is something could be revisited for the development of future enemies.

Perhaps this didn't work because I was increasing a Float value with an Int? The only difference here would be that I type an f after the 1 in Update like this: "1f "

The difference between a Float and an Int is that a Float can output numbers with decimal places, whereas an Int is always a whole number. Sometimes a Float value can't be increased by an Int and vice versa.

No comments:

Post a Comment