Esempio n. 1
0
 public float ChangeLife(float value)
 {
     if (_child != null)
     {
         _child.DOKill();
         _child.Image.color    = Image.color;
         _child.Rect.sizeDelta = Rect.sizeDelta;
         _child.Image.DOFade(0, 0.5f).OnComplete(() => _child.ChangeLife(value));
     }
     Rect.sizeDelta += Vector2.right * value;
     return(GetOutOfRange());
 }
Esempio n. 2
0
    public void ChangeLife(float value)
    {
        float width = _currentBar.ChangeLife(value * _ratio);

        if (width < 0 && ChangeIndex(1))
        {
            Exchange();
            _currentBar.transform.SetAsLastSibling();
            _nextBar.ResetToWidth();
            SetBarData(_currentIndex, _data);
            ChangeLife(width / _ratio);
        }
        else if (width > 0 && ChangeIndex(-1))
        {
            Exchange();
            _currentBar.transform.SetAsLastSibling();
            _currentBar.ResetToZero();
            SetBarData(_currentIndex, _data);
            ChangeLife(width / _ratio);
        }
    }