コード例 #1
0
    void Update()
    {
        // regenerate
        currentHealth += regenRate * Time.deltaTime;

        // checks bounds
        if (currentHealth > maxHealth)
        {
            currentHealth = 100;
        }
        if (currentHealth < 0)
        {
            currentHealth = 0;
        }
        staminaBar.SetHealth(currentHealth);
    }