예제 #1
0
 public void DoRatate(bool isFast = true, float limitTime = 0f)
 {
     if (this.skill == null)
     {
         return;
     }
     if (this.skill.IsAttack)
     {
         if (this.targetUnits != null && this.targetUnits.Count > 0 && this.targetUnits[0] != null && !base.unit.isBuilding)
         {
             base.unit.TurnToTarget(new Vector3?(this.targetUnits[0].trans.position), isFast, true, limitTime);
         }
     }
     else
     {
         Vector3?vector = this.targetPosition;
         if (vector.HasValue)
         {
             if (this.targetUnits == null || this.targetUnits.Count <= 0 || !(this.targetUnits[0] != null) || this.targetUnits[0].unique_id != base.unit.unique_id)
             {
                 if (!this.skill.IsInstance)
                 {
                     if (!base.unit.isBuilding && !TagManager.CheckTag(base.unit, TargetTag.Pet))
                     {
                         Units   arg_14D_0 = base.unit;
                         Vector3?vector2   = this.targetPosition;
                         arg_14D_0.TurnToTarget(new Vector3?(vector2.Value), isFast, true, limitTime);
                     }
                 }
             }
         }
     }
 }
예제 #2
0
        private void DoUpdate(bool updateImmediately = false)
        {
            Vector3 hudbarWorldPos = this.m_targetUnit.surface.HudbarWorldPos;

            hudbarWorldPos.z = 0f;
            this.m_healthBarTrans.position = hudbarWorldPos;
            if (!updateImmediately && Time.frameCount % 2 == 0)
            {
                return;
            }
            this.UpdateFrontHealthBar();
            this.m_curShield = this.m_targetUnit.shield;
            this.m_curHP     = this.m_targetUnit.hp;
            this.UpdateHuDun(this.m_targetUnit.shield, this.m_targetUnit.hp, false);
            if (this.m_targetUnit.isHero || TagManager.CheckTag(this.m_targetUnit, global::TargetTag.EyeUnit))
            {
                this.UpdateRule(this.m_maxHP + this.m_curShield);
            }
            int level = this.m_targetUnit.level;

            if (this.m_LevelLabel != null && this.lv != level)
            {
                this.lv = level;
                this.m_LevelLabel.text = level.ToString();
            }
            this.UpdateExperienceBar();
            if (this.m_blueBloodSprite != null)
            {
                this.m_curMagic = this.m_targetUnit.mp;
                this.m_maxMagic = this.m_targetUnit.mp_max;
                this.UpdateFrontMagicBar();
            }
            this.TryUpdateSlideHealthBarAnim();
        }
예제 #3
0
 public void CallWhenInjured(Units owner)
 {
     this.m_curHP = owner.hp;
     this.m_maxHP = owner.hp_max;
     if (!this.m_isCurVisible)
     {
         return;
     }
     if (!this._needUpdate)
     {
         return;
     }
     if (GlobalSettings.Instance.UIOpt)
     {
         return;
     }
     if (this.m_targetUnit.isHero || TagManager.CheckTag(this.m_targetUnit, global::TargetTag.EyeUnit))
     {
         this.UpdateRule(this.m_maxHP);
     }
     if (!base.gameObject.activeSelf && this.m_IsActive)
     {
         base.gameObject.SetActive(true);
     }
     this.UpdateFrontHealthBar();
     this.UpdateHuDun(this.m_curShield, this.m_curHP, false);
     if (this.m_targetUnit.isHero || TagManager.CheckTag(this.m_targetUnit, global::TargetTag.EyeUnit))
     {
         this.UpdateRule(this.m_maxHP + this.m_curShield);
     }
 }
예제 #4
0
    public static List <Units> findTargets(Units self, Vector3 pos, SkillTargetCamp targetType, global::TargetTag targetTag, float radius)
    {
        List <Units> list      = new List <Units>();
        int          layerMask = 1 << LayerMask.NameToLayer("UnitSelectObj");

        Collider[] array = Physics.OverlapSphere(pos, radius, layerMask);
        for (int i = 0; i < array.Length; i++)
        {
            if (array[i] != null)
            {
                Collider   collider   = array[i];
                GameObject gameObject = collider.transform.parent.gameObject;
                Units      component  = gameObject.GetComponent <Units>();
                if (!component.IsMonsterCreep() || !(self.GetAttackedYouTarget() != component))
                {
                    if (TagManager.CheckTag(component, targetTag))
                    {
                        if (TeamManager.CheckTeam(self.gameObject, gameObject, targetType, null))
                        {
                            if (!(component == null) && component.isLive && component.CanSkillSelected)
                            {
                                if (!list.Contains(component))
                                {
                                    list.Add(component);
                                }
                            }
                        }
                    }
                }
            }
        }
        return(list);
    }
        protected virtual void hitOut(GameObject go)
        {
            if (!this.isActive)
            {
                return;
            }
            if (!TagManager.IsCharacterTarget(go))
            {
                return;
            }
            if (!TagManager.CheckTag(go, this.data.targetTag))
            {
                return;
            }
            if (!TeamManager.CheckTeam(this.self.gameObject, go, this.data.targetCamp, this.parent))
            {
                return;
            }
            Units component = go.GetComponent <Units>();

            if (component == null || !this.active_targets.Contains(component))
            {
                return;
            }
            this.RemoveEffects(component, true);
        }
        protected virtual void hitIn(GameObject go)
        {
            if (Singleton <PvpManager> .Instance.IsInPvp)
            {
                return;
            }
            if (!this.isActive)
            {
                return;
            }
            if (!TagManager.IsCharacterTarget(go))
            {
                return;
            }
            if (!TagManager.CheckTag(go, this.data.targetTag))
            {
                return;
            }
            if (!TeamManager.CheckTeam(this.self.gameObject, go, this.data.targetCamp, this.parent))
            {
                return;
            }
            Units component = go.GetComponent <Units>();

            if (component == null || !component.isLive || this.active_targets.Contains(component))
            {
                return;
            }
            if (this.data.maxNum != 0 && this.active_targets.Count > this.data.maxNum)
            {
                return;
            }
            this.AddEffects(component);
        }
예제 #7
0
        public List <Units> GetListOfRecentlySensedOpponents(Relation relation, TargetTag tagType = TargetTag.All, bool isVisibile = true, bool isCheckTaunted = false, SortType sortType = SortType.None, FindType findType = FindType.None, object param = null)
        {
            this.target_units.Clear();
            bool flag = false;

            for (int i = 0; i < this.m_MemoryId.Count; i++)
            {
                int          num          = this.m_MemoryId[i];
                MemoryRecord memoryRecord = this.m_MemoryMap[num];
                if (memoryRecord != null)
                {
                    if (!isVisibile || memoryRecord.bWithingFOV)
                    {
                        Units unit = MapManager.Instance.GetUnit(num);
                        if (unit == null || !unit.isLive)
                        {
                            this.m_MemoryMap[num] = null;
                        }
                        else if (relation == Relation.Hostility)
                        {
                            if (TeamManager.CanAttack(this.m_Owner, unit))
                            {
                                if (isCheckTaunted && unit.ChaoFeng.IsInState)
                                {
                                    this.target_units.Clear();
                                    this.target_units.Add(unit);
                                    flag = true;
                                    break;
                                }
                                if (TagManager.CheckTag(unit, tagType))
                                {
                                    this.target_units.Add(unit);
                                }
                            }
                        }
                        else if (relation == Relation.Companion && TeamManager.CanAssist(this.m_Owner, unit))
                        {
                            if (TagManager.CheckTag(unit, tagType))
                            {
                                this.target_units.Add(unit);
                            }
                        }
                    }
                }
            }
            if (!flag)
            {
                if (sortType != SortType.None)
                {
                    FindTargetHelper.SortTargets(this.m_Owner, sortType, ref this.target_units);
                }
                if (findType != FindType.None)
                {
                    FindTargetHelper.FilterTargetsRef(this.m_Owner, ref this.target_units, findType, param);
                }
            }
            return(this.target_units);
        }
예제 #8
0
        private bool GetBesetTargetAll(float radius, SkillTargetCamp skillTargetCamp = SkillTargetCamp.All)
        {
            float num  = 0.2f;
            float num2 = 999f;

            this.targetObj = null;
            Dictionary <int, Units> allMapUnits = MapManager.Instance.GetAllMapUnits();
            float num3 = 0.6f;

            if (allMapUnits != null && allMapUnits.Count > 0)
            {
                foreach (KeyValuePair <int, Units> current in allMapUnits)
                {
                    Units value = current.Value;
                    if (!(null == value) && value.isVisibleInCamera && !value.isItem && !value.isBuffItem && value.m_SelectRadius > 0f && this.IsUnitsRightTargetCamp(value, skillTargetCamp))
                    {
                        Vector3 b = Camera.main.WorldToScreenPoint(value.ColliderCenter);
                        b.z = 0f;
                        Vector3 a = this.touchPoint;
                        a.z = 0f;
                        Vector3 position = value.transform.position;
                        float   num4     = Vector3.Distance(position, this.groundPoint);
                        float   num5     = Vector3.Distance(a, b);
                        float   num6     = this.GetDPI() * num;
                        if (TagManager.CheckTag(value, global::TargetTag.Tower))
                        {
                            num6 *= 1.5f;
                            num3  = 1.8f;
                        }
                        else if (TagManager.CheckTag(value, global::TargetTag.Home))
                        {
                            num6 *= 2.4f;
                            num3  = 3f;
                        }
                        else if (TagManager.CheckTag(value, global::TargetTag.Labisi))
                        {
                            num6 *= 2.4f;
                            num3  = 3f;
                        }
                        if ((num5 < num6 + this.GetDPI() * num * 0.2f || num4 <= num3) && num5 < num2)
                        {
                            num2           = num5;
                            this.targetObj = value.gameObject;
                        }
                    }
                }
            }
            if (this.targetObj != null)
            {
                this.validTargetGo = true;
            }
            return(this.validTargetGo);
        }
예제 #9
0
        private bool GetBesetTarget(float radius)
        {
            float num  = 0.3f;
            float num2 = 999f;

            this.targetObj = null;
            Dictionary <int, Units> allMapUnits = MapManager.Instance.GetAllMapUnits();
            float num3 = 0.6f;

            foreach (Units current in allMapUnits.Values)
            {
                if (!(null == current) && current.isVisible && current.isLive && current.isVisibleInCamera && this.self.TeamType != current.TeamType && !current.isItem && !current.isBuffItem && current.m_SelectRadius > 0f && current.UnitType != UnitType.Pet && current.UnitType != UnitType.LabisiUnit)
                {
                    float num4 = Vector3.Distance(current.transform.position, this.groundPoint);
                    if (num4 <= current.m_SelectRadius + 2.5f)
                    {
                        Vector3 b = Camera.main.WorldToScreenPoint(current.ColliderCenter);
                        b.z = 0f;
                        Vector3 a = this.touchPoint;
                        a.z = 0f;
                        float num5 = Vector3.Distance(a, b);
                        float num6 = this.GetDPI() * num;
                        if (TagManager.CheckTag(current, global::TargetTag.Tower))
                        {
                            num6 *= 1.5f;
                            num3  = 1.8f;
                        }
                        else if (TagManager.CheckTag(current, global::TargetTag.Home))
                        {
                            num6 = num6 * 2.4f * current.m_SelectRadius / 2.5f;
                            num3 = 3f * current.m_SelectRadius / 2.5f;
                        }
                        if ((num5 < num6 + this.GetDPI() * num * 0.2f || num4 <= num3) && num5 < num2)
                        {
                            num2           = num5;
                            this.targetObj = current.gameObject;
                        }
                    }
                }
            }
            if (this.targetObj != null)
            {
                this.validTargetGo = true;
            }
            return(this.validTargetGo);
        }
예제 #10
0
        private static void TrySyncMonsterCreepRotation(Units inUnit)
        {
            if (inUnit == null)
            {
                return;
            }
            if (!TagManager.CheckTag(inUnit, global::TargetTag.Creeps))
            {
                return;
            }
            Quaternion spwan_rotation = inUnit.spwan_rotation;

            if (inUnit.mTransform != null)
            {
                inUnit.mTransform.rotation = Quaternion.Euler(spwan_rotation.eulerAngles);
            }
        }
예제 #11
0
 private static void TrySyncMonsterCreepGroupType(Units unit, UnitRuntimeInfo info)
 {
     if (unit == null || info == null || info.baseUnitInfo == null)
     {
         return;
     }
     if (!TagManager.CheckTag(unit, global::TargetTag.Creeps))
     {
         return;
     }
     if (unit.teamType == (int)info.baseUnitInfo.group)
     {
         return;
     }
     unit.teamType = (int)info.baseUnitInfo.group;
     unit.SetBloodBarStyle();
 }
예제 #12
0
        public Units PickBestUnit(Predicate <Units> cond)
        {
            float   num         = 0.3f;
            float   num2        = 999f;
            Units   result      = null;
            Vector3?groundPoint = this.GetGroundPoint();
            Dictionary <int, Units> allMapUnits = MapManager.Instance.GetAllMapUnits();

            foreach (Units current in allMapUnits.Values)
            {
                if (!(null == current) && !current.isItem && !current.isBuffItem && current.m_SelectRadius > 0f && cond(current))
                {
                    float num3 = Vector3.Distance(current.transform.position, groundPoint.Value);
                    if (num3 <= current.m_SelectRadius + 2.5f)
                    {
                        Vector3 b = Camera.main.WorldToScreenPoint(current.ColliderCenter);
                        b.z = 0f;
                        Vector3 touchPos = this._touchPos;
                        touchPos.z = 0f;
                        float num4 = Vector3.Distance(touchPos, b);
                        float num5 = this.GetDPI() * num;
                        if (TagManager.CheckTag(current, TargetTag.Tower))
                        {
                            num5 *= 1.5f;
                        }
                        else if (TagManager.CheckTag(current, TargetTag.Home))
                        {
                            num5 *= 3f;
                        }
                        if (num4 < num5 + this.GetDPI() * num * 0.2f && num4 < num2)
                        {
                            num2   = num4;
                            result = current;
                        }
                    }
                }
            }
            return(result);
        }
예제 #13
0
 public override void Wound(Units attacker, float damage)
 {
     if (damage > 0f)
     {
         return;
     }
     if (this.fWarningTimer < 0f && attacker != null && attacker.isHero)
     {
         this.fWarningTimer = 2f;
         bool          flag     = false;
         IList <Units> mapUnits = MapManager.Instance.GetMapUnits(attacker.TeamType, global::TargetTag.Monster);
         if (mapUnits != null)
         {
             for (int i = 0; i < mapUnits.Count; i++)
             {
                 if (mapUnits[i] != null && (mapUnits[i].transform.position - base.transform.position).sqrMagnitude < 100f && TagManager.CheckTag(mapUnits[i], global::TargetTag.CreepsAndMinions) && mapUnits[i].UnitType != UnitType.SummonMonster)
                 {
                     flag = true;
                     break;
                 }
             }
         }
         if (!flag)
         {
             if (base.isLocalUnit)
             {
                 UIMessageBox.ShowTowerWoundWarn(this);
                 Singleton <MiniMapView> .Instance.ShowTowerMapWarn(this);
             }
             if (this.m_effectFangtouta != null && !this.m_effectFangtouta.isDestroyed)
             {
                 this.m_effectFangtouta.Destroy();
             }
             if (base.TeamType == TeamType.LM)
             {
                 this.m_effectFangtouta = ActionManager.PlayEffect("Fx_Fangtouta_LM", this, null, null, true, string.Empty, null);
             }
             else
             {
                 this.m_effectFangtouta = ActionManager.PlayEffect("Fx_Fangtouta_BL", this, null, null, true, string.Empty, null);
             }
         }
     }
     base.Wound(attacker, damage);
     this._DurationWoundMgr.OnWound(attacker, damage);
     if (this._towerController)
     {
         this._towerController.OnDamage(attacker, damage);
     }
 }
예제 #14
0
 public static bool CheckTarget(GameObject self, GameObject target, SkillTargetCamp targetCampType, TargetTag targetTag)
 {
     return(TagManager.CheckTag(target, targetTag) && TeamManager.CheckTeam(self, target, targetCampType, null));
 }
예제 #15
0
        public UIBloodBar CreateHudBar(Units player)
        {
            ClientLogger.AssertNotNull(player, null);
            if (player == null)
            {
                return(null);
            }
            if (!this.IsOpened)
            {
                CtrlManager.OpenWindow(WindowID.CharacterView, null);
            }
            this.TryShow();
            UIBloodBar uIBloodBar;

            if (player.mHpBar)
            {
                uIBloodBar = player.mHpBar;
            }
            else
            {
                Transform hudBarParent = this.GetHudBarParent(player);
                if (player.isHero)
                {
                    if (player.tag == "Player")
                    {
                        uIBloodBar = this._barRecycler.Create("MainHeroSlider", hudBarParent, player);
                    }
                    else
                    {
                        uIBloodBar = this._barRecycler.Create("HeroSlider", hudBarParent, player);
                    }
                }
                else if (TagManager.CheckTag(player, global::TargetTag.EyeUnit))
                {
                    uIBloodBar = this._barRecycler.Create("EyeSlider", hudBarParent, player);
                }
                else if (player.isMonster)
                {
                    if (player.isCreep)
                    {
                        uIBloodBar = this._barRecycler.Create("CreepSlider", hudBarParent, player);
                    }
                    else
                    {
                        if (player.UnitType == UnitType.Pet)
                        {
                            return(null);
                        }
                        if (player.UnitType == UnitType.SummonMonster)
                        {
                            uIBloodBar = this._barRecycler.Create("SummonerMonsterSlider", hudBarParent, player);
                        }
                        else
                        {
                            uIBloodBar = this._barRecycler.Create("MonsterSlider", hudBarParent, player);
                        }
                    }
                }
                else
                {
                    if (!player.isTower && !player.isHome)
                    {
                        return(null);
                    }
                    uIBloodBar = this._barRecycler.Create("TowerSlider", hudBarParent, player);
                }
                uIBloodBar.name = player.name;
                uIBloodBar.SetTargetUnit(player);
                if (LevelManager.Instance.IsPvpBattleType && (player.isHero || player.isCreep))
                {
                    if (player.isHero)
                    {
                        uIBloodBar.ShowName(true, player.summonerName, player.unique_id);
                    }
                    else
                    {
                        SysMonsterMainVo monsterMainData = BaseDataMgr.instance.GetMonsterMainData(player.npc_id);
                        uIBloodBar.ShowName(true, LanguageManager.Instance.GetStringById(monsterMainData.name), 0);
                    }
                }
                else if (player.isHero && player.tag != "Player")
                {
                    SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(player.npc_id);
                    uIBloodBar.ShowName(true, LanguageManager.Instance.GetStringById(heroMainData.name) + LanguageManager.Instance.GetStringById("BattleAiText_Computer"), 0);
                }
                else if (player.isCreep)
                {
                    SysMonsterMainVo monsterMainData2 = BaseDataMgr.instance.GetMonsterMainData(player.npc_id);
                    uIBloodBar.ShowName(true, LanguageManager.Instance.GetStringById(monsterMainData2.name), 0);
                }
                else
                {
                    uIBloodBar.ShowName(false, null, 0);
                }
                uIBloodBar.transform.localScale = player.surface.HudbarLocalScale;
            }
            uIBloodBar.UpdateHudBarType(player);
            return(uIBloodBar);
        }
예제 #16
0
    public static List <Units> findTargets(Units self, Vector3 pos, SkillTargetCamp targetType, global::TargetTag targetTag, EffectiveRangeType rangeType, float param1 = 0f, float param2 = 0f, int max_num = -1)
    {
        List <Units> list    = new List <Units>();
        List <int>   targets = null;

        switch (targetType)
        {
        case SkillTargetCamp.Self:
            list.Add(self);
            break;

        case SkillTargetCamp.Enemy:
            targets = TeamManager.GetOtherTeam(self.team, Relation.Hostility, true);
            break;

        case SkillTargetCamp.Partener:
            targets = TeamManager.GetOtherTeam(self.team, Relation.Friendly, true);
            break;

        case SkillTargetCamp.AttackYouTarget:
        {
            Units attackedYouTarget = self.GetAttackedYouTarget();
            if (attackedYouTarget != null)
            {
                list.Add(attackedYouTarget);
            }
            targets = TeamManager.GetOtherTeam(self.team, Relation.Hostility, true);
            break;
        }

        case SkillTargetCamp.SkillHitTarget:
        {
            Units skillHitedTarget = self.GetSkillHitedTarget();
            if (skillHitedTarget != null)
            {
                list.Add(skillHitedTarget);
            }
            return(list);
        }

        case SkillTargetCamp.AttackTarget:
        {
            Units attackTarget = self.GetAttackTarget();
            if (attackTarget != null)
            {
                list.Add(attackTarget);
            }
            targets = TeamManager.GetOtherTeam(self.team, Relation.Hostility, true);
            break;
        }

        case SkillTargetCamp.SkillHitYouTarget:
        {
            Units skillHitedYouTarget = self.GetSkillHitedYouTarget();
            if (skillHitedYouTarget != null)
            {
                list.Add(skillHitedYouTarget);
            }
            return(list);
        }

        case SkillTargetCamp.SelectTarget:
            if (self.currentSkillOrAttack != null)
            {
                return(self.currentSkillOrAttack.attackTargets);
            }
            return(list);
        }
        if (list.Count <= 0)
        {
            switch (rangeType)
            {
            case EffectiveRangeType.JuXing:
            case EffectiveRangeType.YuanXing:
            case EffectiveRangeType.ShanXing:
            case EffectiveRangeType.Single:
            {
                float      radius    = (param1 <= param2) ? param2 : param1;
                int        layerMask = 1 << LayerMask.NameToLayer("Vehicle");
                Collider[] array     = Physics.OverlapSphere(pos, radius, layerMask);
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i] != null)
                    {
                        Collider   collider   = array[i];
                        GameObject gameObject = collider.transform.parent.gameObject;
                        Units      component  = gameObject.GetComponent <Units>();
                        if (max_num == -1 || list.Count < max_num)
                        {
                            if (TagManager.CheckTag(component, targetTag))
                            {
                                if (UnitFeature.TargetInRange(collider.transform.position, rangeType, pos, self.transform.eulerAngles, param1, param2))
                                {
                                    if (TeamManager.CheckTeam(self.gameObject, gameObject, targetType, null))
                                    {
                                        if (!(component == null) && component.isLive && component.CanSkillSelected)
                                        {
                                            if (!list.Contains(component))
                                            {
                                                list.Add(component);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            }

            case EffectiveRangeType.AllMap:
            {
                Dictionary <int, Units>             allMapUnits = MapManager.Instance.GetAllMapUnits();
                Dictionary <int, Units> .Enumerator enumerator  = allMapUnits.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    KeyValuePair <int, Units> current = enumerator.Current;
                    Units value = current.Value;
                    if (!(value == null) && value.isLive && value.CanSkillSelected)
                    {
                        if (max_num == -1 || list.Count < max_num)
                        {
                            if (TagManager.CheckTag(value, targetTag))
                            {
                                if (TeamManager.CheckTeamType(value.teamType, targets))
                                {
                                    if (!list.Contains(value))
                                    {
                                        list.Add(value);
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            }

            case EffectiveRangeType.Link:
            {
                float num        = (param1 <= param2) ? param2 : param1;
                int   layerMask2 = 1 << LayerMask.NameToLayer("Vehicle");
                if (max_num > 0)
                {
                    if (!(self == null))
                    {
                        Units attackTarget2 = self.GetAttackTarget();
                        if (!(attackTarget2 == null))
                        {
                            list.Add(attackTarget2);
                            pos = attackTarget2.transform.position;
                            while (list.Count < max_num)
                            {
                                bool       flag   = false;
                                Units      units  = null;
                                float      num2   = -1f;
                                Collider[] array2 = Physics.OverlapSphere(pos, num, layerMask2);
                                for (int j = 0; j < array2.Length; j++)
                                {
                                    if (array2[j] != null)
                                    {
                                        Collider   collider2   = array2[j];
                                        GameObject gameObject2 = collider2.transform.parent.gameObject;
                                        Units      component2  = gameObject2.GetComponent <Units>();
                                        if (max_num != -1 && list.Count >= max_num)
                                        {
                                            break;
                                        }
                                        if (TagManager.CheckTag(component2, targetTag))
                                        {
                                            if (TeamManager.CheckTeam(self.gameObject, gameObject2, targetType, null))
                                            {
                                                if (!(component2 == null) && component2.isLive && component2.CanSkillSelected)
                                                {
                                                    if (!list.Contains(component2))
                                                    {
                                                        if ((units == null || num2 > (pos - component2.transform.position).sqrMagnitude) && (pos - component2.transform.position).sqrMagnitude < num * num)
                                                        {
                                                            units = component2;
                                                            num2  = (pos - component2.transform.position).sqrMagnitude;
                                                        }
                                                        if (units != null)
                                                        {
                                                            flag = true;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                if (!flag)
                                {
                                    break;
                                }
                                list.Add(units);
                                pos = units.transform.position;
                            }
                        }
                    }
                }
                break;
            }
            }
        }
        return(list);
    }