예제 #1
0
    private IEnumerator HungerTick()
    {
        WaitForSeconds waitForSeconds = new WaitForSeconds(3f);

        HealthComponent healthComponent = GetComponent <HealthComponent>();

        while (true)
        {
            yield return(waitForSeconds);

            if (HungerDegenerationActive == false)
            {
                continue;
            }

            if (value == 0)
            {
                healthComponent.DecreaseValue(1f);
            }
            else if (value >= 90)
            {
                healthComponent.IncreaseValue(1f);
            }

            DecreaseValue(1f);
        }
    }
 public void TakeHit(IAttacker attacker)
 {
     lastAttacker = attacker;
     healthComponent.DecreaseValue(attacker.Damage - stats.Defense);
 }