Пример #1
0
        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;
            }
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
     }
 }
Пример #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);
        }
Пример #7
0
        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);
            }
        }
Пример #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;
            }
        }
Пример #9
0
 public CEffect CreateEffect(string id, IEffectHolder holder, CEntity caster, CEntity target)
 {
     return(this._fxManager.CreateEffect(id, holder, caster, target));
 }
Пример #10
0
        public void HandleEntitySyncProps(string rid, Attr[] attrs, object[] values, int count)
        {
            CEntity entity = this._entityManager.GetEntity(rid);

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

            entity.OnRemoveFromBattle();
        }