private void DestroyEnties()
        {
            int count = this._entities.Count;

            for (int i = 0; i < count; i++)
            {
                CEntity entity = this._entities[i];
                if (!entity.markToDestroy)
                {
                    continue;
                }
                UIEvent.EntityDestroied(entity);
                entity.OnDestroy();

                if (entity is CChampion)
                {
                    this._champions.Remove(( CChampion )entity);
                    this._idToChampion.Remove(entity.rid);
                }
                if (entity is CItem item)
                {
                    this._items.Remove(item);
                    this._idToItem.Remove(entity.rid);
                }

                this._entities.RemoveAt(i);
                this._idToEntity.Remove(entity.rid);
                this._gPool.Push(entity);
                --i;
                --count;
            }
        }
Example #2
0
        public void HandleBuffCreated(string buffId, string casterId, string targetId)
        {
            CEntity caster = this._entityManager.GetEntity(casterId);
            CEntity target = this._entityManager.GetEntity(targetId);

            this._buffManager.CreateBuff(buffId, caster, target);
        }
Example #3
0
        public CBuff CreateBuff(string rid, CEntity caster, CEntity target)
        {
            CBuff buff = this._gPool.Pop <CBuff>();

            buff.OnCreate(this._battle, rid, caster, target);
            this._idToBuff[buff.rid] = buff;
            this._buffs.Add(buff);
            return(buff);
        }
Example #4
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);
        }
Example #5
0
 public void OnCreate(CBattle battle, string rid, CEntity castr, CEntity target)
 {
     this.battle = battle;
     this.rid    = rid;
     this._data  = ModelFactory.GetBuffData(Utils.GetIDFromRID(this.rid));
     if (!string.IsNullOrEmpty(this._data.fx))
     {
         this.battle.CreateEffect(this._data.fx, this, castr, target);
     }
     if (!string.IsNullOrEmpty(this._data.snd))
     {
         target.graphic.audioSource.PlayOneShot(this._data.snd, 1f);
     }
 }
Example #6
0
        public void HandleEntityAddedToBattle(string rid)
        {
            CEntity entity = this._entityManager.GetEntity(rid);

            entity.OnAddedToBattle();
            if (entity is CPlayer)
            {
                this.camera.enable = true;
                this.camera.target = CPlayer.instance.graphic.root;
                this.camera.UpdateVisualImmediately();
                this.camera.PlayDelay(this._data.bgSnd, 3f);
            }

            UIEvent.EntityCreated(entity);
        }
        private void UpdateState(UpdateContext context)
        {
            //champoin
            int count = this._champions.Count;

            for (int i = 0; i < count; i++)
            {
                CEntity entity = this._champions[i];
                entity.OnUpdateState(context);
            }
            //item
            count = this._items.Count;
            for (int i = 0; i < count; i++)
            {
                CEntity entity = this._items[i];
                entity.OnUpdateState(context);
            }
        }
Example #8
0
        public void HandleEntityCreate(string type, EntityParam param)
        {
            switch (type)
            {
            case "Champion":
                CEntity entity = this._uid == param.uid
                                                                                 ? this._entityManager.Create <CPlayer>(param)
                                                                                 : this._entityManager.Create <CChampion>(param);
                break;

            case "Rail":
                this._entityManager.Create <CRail>(param);
                break;

            case "Item":
                this._entityManager.Create <CItem>(param);
                break;

            case "Terminus":
                this._terminus = this._entityManager.Create <CTerminus>(param);
                break;
            }
        }
Example #9
0
 public CEffect CreateEffect(string id, IEffectHolder holder, CEntity caster, CEntity target)
 {
     return(this._fxManager.CreateEffect(id, holder, caster, target));
 }
Example #10
0
        public void HandleEntitySyncProps(string rid, Attr[] attrs, object[] values, int count)
        {
            CEntity entity = this._entityManager.GetEntity(rid);

            entity.HandleSyncProps(attrs, values, count);
        }
Example #11
0
        public void HandleEntityRemoveFromBattle(string rid)
        {
            CEntity entity = this._entityManager.GetEntity(rid);

            entity.OnRemoveFromBattle();
        }