private void CheckStat(BaseStat stat)
        {
            if (_statText != null)
            {
                _statText.text = stat.ToString();
            }
            if (_actor.Entity.Tags.Contain(EntityTags.IsDead))
            {
                _statTween.Restart(_statSlider.value, 0, 0.35f);
                return;
            }
            if (_statTween.Active)
            {
                return;
            }
            if (_statTween.Length <= 0)
            {
                _statSlider.value = _actor.GetVital(_targetStat).CurrentPercent;
                return;
            }
            var percent        = _actor.GetVital(_targetStat).CurrentPercent;
            var statDifference = Mathf.Abs(_statSlider.value - percent);

            if (statDifference > 0.05f)
            {
                _statTween.Restart
                    (_statSlider.value, percent, Mathf.Lerp(0.35f, _maxTweenLength, statDifference));
            }
        }
Exemple #2
0
 private void RefreshText(BaseStat stat)
 {
     _text.text = stat.ToString();
 }
Exemple #3
0
 public void AssignStat(BaseStat stat)
 {
     _stat                = stat;
     _text.text           = _stat.ToString();
     _stat.OnStatChanged += RefreshText;
 }