public static bool CheckTeam(GameObject self, GameObject target, SkillTargetCamp targetCampType, Units parentUnit = null) { switch (targetCampType) { case SkillTargetCamp.Self: return(self && target && self.name.Equals(target.name)); case SkillTargetCamp.Enemy: case SkillTargetCamp.AttackYouTarget: case SkillTargetCamp.AttackTarget: return(TeamManager.CheckTeam(target, TeamManager.GetOtherTeam(TeamManager.GetTeam(self), Relation.Hostility, true))); case SkillTargetCamp.Partener: return(TeamManager.CheckTeam(target, TeamManager.GetOtherTeam(TeamManager.GetTeam(self), Relation.Companion, false))); case SkillTargetCamp.All: return(true); case SkillTargetCamp.AllWhitOutSelf: return(!self.name.Equals(target.name)); case SkillTargetCamp.ParentObj: return(parentUnit != null && target != null && parentUnit.name.Equals(target.name)); case SkillTargetCamp.AllWhitOutPartener: return((self && target && self.name.Equals(target.name)) || !TeamManager.CheckTeam(target, TeamManager.GetOtherTeam(TeamManager.GetTeam(self), Relation.Companion, false))); } return(false); }
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); }
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); }
public static Units findDyingTarget(Units self, Vector3 pos, SkillTargetCamp targetType, global::TargetTag targetTag, EffectiveRangeType rangeType, float param1 = 0f, float param2 = 0f) { Units result = null; List <Units> list = FindTargetHelper.findTargets(self, pos, targetType, targetTag, rangeType, param1, param2, -1); if (list != null) { if (list.Count > 1) { result = FindTargetHelper.findDyingTarget(self.transform.position, list); } else { result = list[0]; } } return(result); }
public static Units findClosestTarget(Units self, Vector3 pos, SkillTargetCamp targetType, global::TargetTag targetTag, EffectiveRangeType rangeType, float param1 = 0f, float param2 = 0f) { List <Units> list = FindTargetHelper.findTargets(self, pos, targetType, targetTag, rangeType, param1, param2, -1); Units result = null; if (list != null) { if (list.Count > 1) { result = FindTargetHelper.findClosestTarget(pos, list); } else if (list.Count == 1) { result = list[0]; } } return(result); }
public bool UpdateTargetAll(Vector3 point, SkillTargetCamp skillTargetCamp) { this.touchPoint = point; this.validGroundPoint = false; this.validTargetGo = false; this.validTargetUnit = false; if (!this.GetBattleShopPoint()) { if (this.GetGroundPoint()) { float radius = this.GetDPI() * 0.5f; if (this.GetBesetTargetAll(radius, skillTargetCamp)) { this.RightTargetAll(); } } } return(this.ValidGroudPoint || this.ValidTargetUnit); }
private bool IsUnitsRightTargetCamp(Units target, SkillTargetCamp skillTargetCamp) { return(TeamManager.CheckTeam(this.self.gameObject, target.gameObject, skillTargetCamp, null)); }
public void Parse(SysSkillMainVo skillAttr) { if (StringUtils.CheckValid(skillAttr.ConjureRangetype)) { this.IsUseSkillPointer = true; string[] array = skillAttr.ConjureRangetype.Split(new char[] { '|' }); if (array.Length > 0) { string text = array[0]; switch (text) { case "1": if (array.Length == 3) { this.SkillPointerType = SkillPointerType.RectanglePointer; this.PointerLength = float.Parse(array[1]); this.PointerWidth = float.Parse(array[2]); } break; case "2": if (array.Length == 2) { this.SkillPointerType = SkillPointerType.CirclePointer; this.PointerRadius = float.Parse(array[1]); } break; case "3": if (array.Length == 3) { this.SkillPointerType = SkillPointerType.SectorPointer; this.PointerRadius = float.Parse(array[1]); this.SectorPointerAngle = float.Parse(array[2]); } break; } } } this.logicType = (SkillLogicType)skillAttr.skill_logic_type; string str = Convert.ToString(skillAttr.need_target); int[] stringToInt = StringUtils.GetStringToInt(str, '|'); if (stringToInt != null && stringToInt.Length > 0) { this.needTarget = (stringToInt[0] != 0); } if (stringToInt != null && stringToInt.Length > 1) { this.skillCastingType = stringToInt[1]; } this.skill_prop = skillAttr.skill_prop; if (StringUtils.CheckValid(skillAttr.skill_mutex)) { this.skillMutexs = StringUtils.GetStringValue(skillAttr.skill_mutex, ','); } if (StringUtils.CheckValid(skillAttr.guide_time)) { string[] stringValue = StringUtils.GetStringValue(skillAttr.guide_time, '|'); this.isGuide = (stringValue != null && float.Parse(stringValue[0]) > 0f); this.guideTime = ((!this.isGuide) ? 0f : float.Parse(stringValue[1])); this.guideInterval = ((!this.isGuide) ? 0f : float.Parse(stringValue[2])); if (stringValue.Length > 3 && this.isGuide) { this.isShowGuideBar = (int.Parse(stringValue[3]) != 0); } this.interrupt = (skillAttr.interrupt != 0); } if (StringUtils.CheckValid(skillAttr.cost)) { this.cost_ids = StringUtils.GetStringToInt(skillAttr.cost, ','); } if (StringUtils.CheckValid(skillAttr.target_type)) { int[] stringToInt2 = StringUtils.GetStringToInt(skillAttr.target_type, '|'); this.targetCamp = (SkillTargetCamp)((stringToInt2 == null) ? 0 : stringToInt2[0]); this.targetTag = (TargetTag)((stringToInt2.Length <= 1) ? 0 : stringToInt2[1]); } if (StringUtils.CheckValid(skillAttr.effective_range)) { string[] stringValue2 = StringUtils.GetStringValue(skillAttr.effective_range, ','); if (stringValue2.Length > 0) { float[] stringToFloat = StringUtils.GetStringToFloat(stringValue2[0], '|'); this.effectiveRangeType = (this.selectRangeType = ((stringToFloat == null) ? EffectiveRangeType.None : ((EffectiveRangeType)stringToFloat[0]))); this.effectRange1 = (this.selectRange1 = ((stringToFloat.Length <= 1) ? 0f : stringToFloat[1])); this.effectRange2 = (this.selectRange2 = ((stringToFloat.Length <= 2) ? 0f : stringToFloat[2])); } if (stringValue2.Length > 1) { float[] stringToFloat2 = StringUtils.GetStringToFloat(stringValue2[1], '|'); this.selectRangeType = ((stringToFloat2 == null) ? EffectiveRangeType.None : ((EffectiveRangeType)stringToFloat2[0])); this.selectRange1 = ((stringToFloat2.Length <= 1) ? 0f : stringToFloat2[1]); this.selectRange2 = ((stringToFloat2.Length <= 2) ? 0f : stringToFloat2[2]); } } this.isAbsorbMp = false; this.isDiJianWoZeng = false; this.damageProbability = 100f; this.isCanMoveInSkillCastin = false; this.isMoveSkill = false; if (StringUtils.CheckValid(skillAttr.skill_mutex)) { string[] stringValue3 = StringUtils.GetStringValue(skillAttr.skill_mutex, ','); for (int i = 0; i < stringValue3.Length; i++) { string[] stringValue4 = StringUtils.GetStringValue(stringValue3[i], '|'); if (stringValue4[0] == "1") { this.damageProbability = (float)int.Parse(stringValue4[1]); } else if (stringValue4[0] == "2") { if (stringValue4[1] == "1") { this.isAbsorbMp = true; } else if (stringValue4[1] == "0") { this.isAbsorbMp = false; } } else if (stringValue4[0] == "3") { if (stringValue4[1] == "1") { this.isDiJianWoZeng = true; } else if (stringValue4[1] == "0") { this.isDiJianWoZeng = false; } } else if (stringValue4[0] == "4") { if (stringValue4[1] == "1") { this.isCanMoveInSkillCastin = true; } else if (stringValue4[1] == "0") { this.isCanMoveInSkillCastin = false; } } else if (stringValue4[0] == "6") { if (stringValue4[1] == "1") { this.continueMoveAfterSkillEnd = true; } else if (stringValue4[1] == "0") { this.continueMoveAfterSkillEnd = false; } } else if (stringValue4[0] == "7") { if (stringValue4[1] == "1") { this.isMoveSkill = true; } else if (stringValue4[1] == "0") { this.isMoveSkill = false; } } } } if (StringUtils.CheckValid(skillAttr.ready_action_ids)) { this.ready_actions = StringUtils.GetStringValue(skillAttr.ready_action_ids, ','); } if (StringUtils.CheckValid(skillAttr.start_action_ids)) { string[] stringValue5 = StringUtils.GetStringValue(skillAttr.start_action_ids, ','); List <string> list = new List <string>(); List <string> list2 = new List <string>(); for (int j = 0; j < stringValue5.Length; j++) { string[] stringValue6 = StringUtils.GetStringValue(stringValue5[j], '|'); if (stringValue6.Length == 2) { if (stringValue6[0] == "1") { list.Add(stringValue6[1]); } else if (stringValue6[0] == "2") { list2.Add(stringValue6[1]); } } else if (stringValue6.Length == 1) { list.Add(stringValue6[0]); } } this.start_actions = list.ToArray(); this.crit_start_actions = list2.ToArray(); } if (StringUtils.CheckValid(skillAttr.hit_action_ids)) { string[] stringValue7 = StringUtils.GetStringValue(skillAttr.hit_action_ids, ','); List <string> list3 = new List <string>(); List <string> list4 = new List <string>(); List <string> list5 = new List <string>(); for (int k = 0; k < stringValue7.Length; k++) { string[] stringValue8 = StringUtils.GetStringValue(stringValue7[k], '|'); if (stringValue8.Length == 2) { if (stringValue8[0] == "1") { list3.Add(stringValue8[1]); } else if (stringValue8[0] == "2") { list4.Add(stringValue8[1]); } else if (stringValue8[0] == "3") { list5.Add(stringValue8[1]); } } else if (stringValue8.Length == 1) { list3.Add(stringValue8[0]); } } this.hit_actions = list3.ToArray(); this.crit_hit_actions = list4.ToArray(); this.friend_hit_actions = list5.ToArray(); } if (StringUtils.CheckValid(skillAttr.end_action_ids)) { this.end_actions = StringUtils.GetStringValue(skillAttr.end_action_ids, ','); } if (StringUtils.CheckValid(skillAttr.init_higheff_ids)) { this.init_higheff_ids = StringUtils.GetStringValue(skillAttr.init_higheff_ids, ','); } if (StringUtils.CheckValid(skillAttr.start_higheff_ids)) { this.start_higheff_ids = StringUtils.GetStringValue(skillAttr.start_higheff_ids, ','); } if (StringUtils.CheckValid(skillAttr.hit_higheff_ids)) { this.hit_higheff_ids = StringUtils.GetStringValue(skillAttr.hit_higheff_ids, ','); } if (StringUtils.CheckValid(skillAttr.start_buff_ids)) { this.start_buff_ids = StringUtils.GetStringValue(skillAttr.start_buff_ids, ','); } if (StringUtils.CheckValid(skillAttr.hit_buff_ids)) { this.hit_buff_ids = StringUtils.GetStringValue(skillAttr.hit_buff_ids, ','); } if (StringUtils.CheckValid(skillAttr.skill_phase)) { string[] stringValue9 = StringUtils.GetStringValue(skillAttr.skill_phase, ','); if (stringValue9 != null && stringValue9.Length == 3) { this.castBefore = float.Parse(stringValue9[0]); this.castIn = float.Parse(stringValue9[1]); this.castEnd = float.Parse(stringValue9[2]); } } if (this.config.skill_type == 1) { this.interruptBefore = SkillInterruptType.Force; } else if (this.config.skill_type == 2) { this.interruptBefore = SkillInterruptType.Passive; } this.interruptIn = (SkillInterruptType)this.config.interrupt; this.interruptEnd = SkillInterruptType.Force; if (StringUtils.CheckValid(skillAttr.hit_time)) { this.hitTimes = StringUtils.GetStringToFloat(skillAttr.hit_time, ','); } if (StringUtils.CheckValid(skillAttr.damage_id)) { this.damage_ids = StringUtils.GetStringToInt(skillAttr.damage_id, ','); } if (StringUtils.CheckValid(skillAttr.skill_unique)) { int[] stringToInt3 = StringUtils.GetStringToInt(skillAttr.skill_unique, '|'); if (stringToInt3 != null && stringToInt3.Length == 2) { this.m_nSkillUnique = stringToInt3[0]; this.m_nPriority = stringToInt3[1]; } } }
public static bool CheckTarget(GameObject self, GameObject target, SkillTargetCamp targetCampType, TargetTag targetTag) { return(TagManager.CheckTag(target, targetTag) && TeamManager.CheckTeam(self, target, targetCampType, null)); }
private void Parse(SysSkillHigheffVo higheff_vo) { if (StringUtils.CheckValid(higheff_vo.target_type)) { int[] stringToInt = StringUtils.GetStringToInt(higheff_vo.target_type, '|'); this.targetCamp = (SkillTargetCamp)((stringToInt == null) ? 0 : stringToInt[0]); this.targetTag = (TargetTag)((stringToInt.Length <= 1) ? 0 : stringToInt[1]); } if (StringUtils.CheckValid(higheff_vo.effective_range)) { float[] stringToFloat = StringUtils.GetStringToFloat(higheff_vo.effective_range, '|'); this.rangeRadius = ((stringToFloat == null) ? 0f : stringToFloat[0]); this.maxNum = ((stringToFloat.Length <= 1) ? 2147483647 : ((int)stringToFloat[1])); this.higheffTrigerCount = ((stringToFloat.Length <= 2) ? 2147483647 : ((int)stringToFloat[2])); } if (StringUtils.CheckValid(higheff_vo.higheff_type)) { string[] stringValue = StringUtils.GetStringValue(higheff_vo.higheff_type, '|'); this.higheffType = (HighEffType)int.Parse(stringValue[0]); this.SetHighEffParam(this.higheffType, stringValue); } if (StringUtils.CheckValid(higheff_vo.cd_time)) { string[] stringValue2 = StringUtils.GetStringValue(higheff_vo.cd_time, ','); this.cdTime = ((stringValue2.Length <= 0) ? 0f : float.Parse(stringValue2[0])); this.delayTime = ((stringValue2.Length <= 1) ? 0f : float.Parse(stringValue2[1])); } if (StringUtils.CheckValid(higheff_vo.perform_id)) { this.performIds = StringUtils.GetStringValue(higheff_vo.perform_id, ','); } if (StringUtils.CheckValid(higheff_vo.attach_higheff)) { this.attachHighEffs = StringUtils.GetStringValue(higheff_vo.attach_higheff, ','); } if (StringUtils.CheckValid(higheff_vo.attach_buff)) { this.attachBuffs = StringUtils.GetStringValue(higheff_vo.attach_buff, ','); } if (StringUtils.CheckValid(higheff_vo.attach_self_higheff)) { this.attachSelfHighEffs = StringUtils.GetStringValue(higheff_vo.attach_self_higheff, ','); } this.isAutoDestroy = (higheff_vo.isAutoDestroy != 0); if (StringUtils.CheckValid(higheff_vo.damage_id)) { this.damage_ids = StringUtils.GetStringToInt(higheff_vo.damage_id, ','); } if (StringUtils.CheckValid(higheff_vo.effectGain)) { string[] stringValue3 = StringUtils.GetStringValue(higheff_vo.effectGain, '|'); if (stringValue3.Length > 0) { this.DataType.MagicType = (EffectMagicType)int.Parse(stringValue3[0]); } if (stringValue3.Length > 1) { this.DataType.GainType = (EffectGainType)int.Parse(stringValue3[1]); } if (stringValue3.Length > 2) { this.DataType.ImmuneType = (EffectImmuneType)int.Parse(stringValue3[2]); } } }
public static Units FindAutoSkillTarget(Units self, Vector3 pos, global::TargetTag targetTag, float radius, SkillTargetCamp skillTargetCamp = SkillTargetCamp.None, Skill skill = null) { List <Units> target_units = new List <Units>(); Units target = null; if (targetTag == global::TargetTag.Hero) { target = PlayerControlMgr.Instance.GetSelectedTarget(); if (target != null && Vector3.Distance(pos, target.mTransform.position) < radius) { return(target); } target = null; } else { if (skill == null) { target = FindTargetHelper.FindNearst(self, pos, targetTag); } else { target = FindTargetHelper.findClosestTarget(self, pos, skillTargetCamp, targetTag, skill.data.selectRangeType, skill.data.selectRange1, skill.data.selectRange2); } if (target != null && Vector3.Distance(pos, target.mTransform.position) < radius) { return(target); } target = null; } IList <Units> allHeroes = MapManager.Instance.GetAllHeroes(); for (int i = 0; i < allHeroes.Count; i++) { target = allHeroes[i]; if (Vector3.Distance(self.mTransform.position, target.mTransform.position) <= radius) { if (!(target == null) && target.isLive && target.CanSkillSelected && target.IsManualSelectable()) { if ((TeamManager.CanAttack(self, target) || (self != target && target.isHero && skillTargetCamp == SkillTargetCamp.AllWhitOutSelf) || skillTargetCamp == SkillTargetCamp.Partener || skillTargetCamp == SkillTargetCamp.All) && !target_units.Contains(target)) { target_units.Add(target); } } } } target = null; if (target_units.Count == 0) { return(target); } IList <Units> mapUnits = MapManager.Instance.GetMapUnits(self.TeamType, global::TargetTag.Hero); Units x = mapUnits.FirstOrDefault(delegate(Units unit) { target = unit.GetAttackTarget(); if (target == null) { target = unit.GetSkillHitedTarget(); } if (target == null) { target = unit.GetAttackedYouTarget(); } if (target == null) { target = unit.GetSkillHitedYouTarget(); } return(target_units.Contains(target)); }); if (x == null) { FindTargetHelper.SortTargets(self, GlobalSettings.Instance.AttackSortType, ref target_units); target = target_units[0]; } return(target); }
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); }