public void Activate(BuffDescriptor buffDescriptor) { Active = true; gameObject.SetActive(true); Image.sprite = buffDescriptor.Sprite; DurationImage.fillAmount = 0; DurationText.text = buffDescriptor.Duration.ToString("n1"); transform.SetAsFirstSibling(); }
internal void ApplyBuff(BuffDescriptor newBuffDescriptor) { BuffInstance match = CurrentBuffs.Find(x => x.buffDescriptor.name == newBuffDescriptor.name); if (match != null) { StackBuff(match); } else { if (Visualize) { BuffElement buffElement = GetAvalibleBuffElement(); if (buffElement != null) { BuffInstance newBUff = new BuffInstance(); newBUff.buffDescriptor = newBuffDescriptor; newBUff.Duration = newBuffDescriptor.Duration; newBUff.FullDuration = newBuffDescriptor.Duration; newBUff.BuffElement = buffElement; buffElement.Activate(newBUff.buffDescriptor); CurrentBuffs.Add(newBUff); } else { Debug.LogWarning("Dont Get Buff Element"); } } else { BuffInstance newBUff = new BuffInstance(); newBUff.buffDescriptor = newBuffDescriptor; newBUff.Duration = newBuffDescriptor.Duration; newBUff.FullDuration = newBuffDescriptor.Duration; CurrentBuffs.Add(newBUff); } } }