Automatic health revive

Hay everyone

I'm using the Unity FPS tutorial, but i don't like the idea of the health. If you have been hitted, you need to pick up the health object to fill your health. But now my question is: how can i care for a health that is auto filling after you had been hit.

If your health is max. 100 hitpoints, and the robot removes 50 hitpoints of your health. then your health need to revive automatical to 100 hitpoints without picking up the healthobject. It need to fill 20 hitpoints per second automatic. till it's 100

sorry for my english.

Hope someone can help me.

I never used the FPS tutorial but in general this line would be enough:

function Update() {
    hitPoints = Mathf.Min(maximumHitPoints,hitPoints + 20*Time.deltaTime);
}

You just need to append this to the `FPSPlayer.js`. The point is you said you want it to go back to 100.0 but in the FPS tutorial `maximumHitPoints` is set to 250 and not 100. I've downloaded the FPS tutorial just for you. Did you even go through the tutorial? Or did you just download the completed version?

Used: