How to create life restorer?

You would need to create a simple custom ItemAction (of the UsableItem type). In your ItemAction's StartItemUse method, you would do the health gain stuff. Flashlight.cs in the demo scene is a good example of a basic custom ItemAction.

A simple starting point (not complete):

C#:
public class HealthRestorer : UsableItem
{
    Health characterHealth;
    
    protected override void Awake() {
        characterHealth = m_Character.GetComponent<Health>();
    }
    
    public override void StartItemUse(ItemAbility itemAbility) {
        base.StartItemUse(itemAbility);
        
        health.Heal(10);
    }
}
 
Top