Table of Contents

Drink a potion

class MyHero : AutomaticHero
{
    void Update()
    {
        if (UnityEngine.Input.GetKeyDown(KeyCode.F1))
        {
            DrinkHealthPotion();
        }
    }
}

Drink a potion on low health

class MyHero : AutomaticHero
{
    void Update()
    {
        if (Health < MaxHealth)
        {
            if (HasHealthPotion())
            {
                DrinkHealthPotion();
            }
        }
    }
}