示例#1
0
        public void GetChampionsNearby(CChampion target, TargetType targetType, float radius, int maxNumber, ref List <CChampion> champions)
        {
            if (maxNumber <= 0)
            {
                return;
            }

            if (targetType == TargetType.Self)
            {
                champions.Add(target);
                return;
            }

            radius *= radius;
            int count = this._champions.Count;

            for (int i = 0; i < count; i++)
            {
                CChampion champion = this._champions[i];

                if (targetType == TargetType.Hostile &&
                    champion.team == target.team)
                {
                    continue;
                }

                if (targetType == TargetType.Teamate &&
                    champion.team != target.team)
                {
                    continue;
                }

                if (champion == target)
                {
                    champions.Add(target);
                    continue;
                }

                Vector3 d = target.position - champion.position;
                if (d.sqrMagnitude <= radius)
                {
                    champions.Add(champion);
                }

                if (this._champions.Count == maxNumber)
                {
                    break;
                }
            }
        }
示例#2
0
        public T Create <T>(EntityParam param) where T : CEntity, new()
        {
            T entity = this._gPool.Pop <T>();

            this._idToEntity[param.rid] = entity;
            this._entities.Add(entity);

            System.Type t = typeof(T);
            if (typeof(CItem).IsAssignableFrom(t))
            {
                CItem item = entity as CItem;
                this._idToItem[param.rid] = item;
                this._items.Add(item);
            }
            if (typeof(CChampion).IsAssignableFrom(t))
            {
                CChampion champion = entity as CChampion;
                this._idToChampion[param.rid] = champion;
                this._champions.Add(champion);
            }
            entity.OnCreated(this._battle, param);

            return(entity);
        }
示例#3
0
 public void GetChampionsNearby(CChampion target, TargetType targetType, float radius, int maxNumber, ref List <CChampion> champions)
 {
     this._entityManager.GetChampionsNearby(target, targetType, radius, maxNumber, ref champions);
 }
示例#4
0
        public void HandleUseItem(string targetId, bool result)
        {
            CChampion entity = this._entityManager.GetChampion(targetId);

            UIEvent.ItemUsed(entity, result);
        }
示例#5
0
        public void HandlePickItem(string targetId, string itemId)
        {
            CChampion entity = this._entityManager.GetChampion(targetId);

            UIEvent.PickItem(entity, itemId);
        }
示例#6
0
        public void HandleEntityStateChanged(string rid, FSMStateType type, bool force, object[] param)
        {
            CChampion entity = this._entityManager.GetChampion(rid);

            entity.HandleEntityStateChanged(type, force, param);
        }