public void RemoveBuff(BuffScript buff) { buff.OnRemoved(); Buffs.Remove(buff.Slot); Owner.Game.Send(new BuffRemoveMessage(Owner.NetId, buff.Slot, buff.BuffName.HashString(), 0f)); }
public BuffScript GetBuffWithName(string name) { BuffScript res = null; foreach (BuffScript buff in buffs) { if (buff.buffName == name) { res = buff; } } return(res); }
public void AddBuff(BuffScript prefabBuff) { BuffScript buff = GetBuffWithName(prefabBuff.buffName); if (buff == null) { buff = Instantiate(prefabBuff); buff.gameObject.transform.SetParent(unit.transform, false); buff.AddBuffTo(buffs); buff.ApplyBaseEffect(unit); } else { buff.buffTimer = 0f; } }