Esempio n. 1
0
    protected IEnumerator DegradeHungerOverTime()
    {
        while (hungerStat.currentValue > 0)
        {
            yield return(hungerWaitTime);

            hungerStat.ChangeCurrentValueRaw(-1);
        }

        if (hungerStat.currentValue <= 0)
        {
            hungry = true;
            hungerStat.SetCurrentValueRaw(0);
        }
        //else hungry = false;
    }
Esempio n. 2
0
    protected IEnumerator DegradeThirstOverTime()
    {
        while (thirstStat.currentValue > 0)
        {
            yield return(thirstWaitTime);

            thirstStat.ChangeCurrentValueRaw(-1);
        }

        if (thirstStat.currentValue <= 0)
        {
            thirsty = true;
            thirstStat.SetCurrentValueRaw(0);
        }
        //else thirsty = false;
    }
        private void ChangeStat(IStat statToChange, Collider col, float amount)
        {
            if (statToChange == null)
            {
                return; // Character doesn't have this stat
            }

            statToChange.ChangeCurrentValueRaw(amount);
            AudioManager.AudioPlayOneShot(_audioClipOnDamage);

            if (_particleEffect != null)
            {
                var particles = Instantiate(_particleEffect);
                particles.transform.position = col.transform.position + _particleOffset;

                Destroy(particles.gameObject, 1.0f);
            }
        }