Esempio n. 1
0
        private void OnBuffsChanged()
        {
            var currentBuffs = PlayerBuff.GetAll();

            for (int i = 0; i < currentBuffs.Count; i++)
            {
                if (_buffs.Count < i + 1)
                {
                    _buffs.Add(Instantiate(buffItem, transform).Initialize(currentBuffs[i]));
                }
                else
                {
                    _buffs[i].Initialize(currentBuffs[i]);
                }
            }

            if (_buffs.Count > currentBuffs.Count)
            {
                for (int i = currentBuffs.Count; i < _buffs.Count; i++)
                {
                    _buffs[i].Disable();
                }
            }
        }