public override void Update(float dt)
        {
            base.Update(dt);

            if (!addedIcons)
            {
                addedIcons = true;

                foreach (var b in Buffs.Values)
                {
                    var part = new BuffParticle(b, Entity);
                    Particles.Add(part);
                    Engine.Instance.State.Ui.Add(part);
                }
            }

            foreach (var buff in Buffs.Values)
            {
                buff.Update(dt);
            }

            foreach (var key in Buffs.Keys.ToList())
            {
                var buff = Buffs[key];

                if (buff.TimeLeft <= 0)
                {
                    Remove(key);
                }
            }
        }
        public Buff Add(Buff buff)
        {
            if (buff == null)
            {
                return(null);
            }

            var type = buff.GetType();

            if (Buffs.ContainsKey(type))
            {
                return(null);
            }

            foreach (var t in immune)
            {
                if (t == type)
                {
                    return(null);
                }
            }

            if (Send(new BuffCheckEvent {
                Entity = Entity,
                Buff = buff
            }))
            {
                return(null);
            }

            Buffs[type] = buff;
            buff.Entity = Entity;
            buff.Init();

            Send(new BuffAddedEvent {
                Buff = buff
            });

            if (Engine.Instance.State is InGameState && buff.GetIcon() != null)
            {
                var part = new BuffParticle(buff, Entity);
                Particles.Add(part);
                Engine.Instance.State.Ui.Add(part);
            }

            return(buff);
        }