Пример #1
0
        public CEffect CreateEffect(string id, IEffectHolder holder, CEntity caster, CEntity target)
        {
            CEffect effect = this._gPool.Pop <CEffect>();
            string  rid    = Utils.MakeRidFromID(id);

            effect.OnCreate(this._battle, rid, holder, caster, target);
            this._idToEffect[effect.rid] = effect;
            this._effects.Add(effect);
            return(effect);
        }
Пример #2
0
        public void Update(UpdateContext context)
        {
            int count = this._effects.Count;

            for (int i = 0; i < count; i++)
            {
                CEffect effect = this._effects[i];
                effect.OnUpdate(context);
            }
            this.DestroyEffects();
        }
Пример #3
0
        private void DestroyEffects()
        {
            int count = this._effects.Count;

            for (int i = 0; i < count; i++)
            {
                CEffect effect = this._effects[i];
                if (!effect.markToDestroy)
                {
                    continue;
                }
                effect.OnDestroy();

                this._effects.RemoveAt(i);
                this._idToEffect.Remove(effect.rid);
                this._gPool.Push(effect);
                --i;
                --count;
            }
        }