예제 #1
0
    private void SetBarData(int index, List <LifeBarData> data)
    {
        if (index < 0 || index >= data.Count)
        {
            return;
        }

        _currentBar.SetData(data[index]);

        if (index + 1 >= data.Count)
        {
            _nextBar.SetData(new LifeBarData(null, color: Color.white));
        }
        else
        {
            _nextBar.SetData(data[index + 1]);
        }
    }
예제 #2
0
    public void SetData(LifeBarData data)
    {
        Image.color = data.BarMainColor;
        if (data.BarSprite != null)
        {
            Image.sprite = data.BarSprite;
        }

        if (_child != null)
        {
            _child.SetData(data);
        }
    }