Skip to main content

Regeneration

Add regeneration functionality of the Vitals componenets.

Basic Usage

Start by adding the the correct Regeneration component to your object, and assign the Vitals component to it.

Add Regeneration

Set the default regeneration and drain rates.

NOTE: The values represent the regeneration/drain rate per second.

And now using the reference to the Health/Stamina component, you can call the regeneration methods.

private Health health;

private void Awake(){
health = GetComponent<Health>();
}

To start and stop regeneration use:

health.Regeneration.StartRegeneration();

health.Regeneration.StopRegeneration();

To start and stop draining use:

health.Regeneration.StartDrain();

health.Regeneration.StopDrain();

NOTE: Starting regeneration will stop any active drain on the component and vice versa.

To change the regeneration and drain values at runtime, use:

health.Regeneration.SetRegenerationRate(1f);

health.Regeneration.SetDrainRate(1f);