private Units GetTowerPriorityTarget() { List <Units> list = new List <Units>(); IList <Units> mapUnits = MapManager.Instance.GetMapUnits((TeamType)this.m_Owner.teamType, TargetTag.Hero); if (mapUnits == null) { return(null); } List <Units> list2 = new List <Units>(); foreach (Units current in mapUnits) { if (UnitFeature.TargetInDistance(this.m_Owner.transform, current.transform, this.m_Owner.GetAttackRange(current))) { list2.Add(current); } } if (mapUnits != null) { foreach (Units current2 in mapUnits) { AIManager aiManager = current2.aiManager; foreach (Units current3 in aiManager.GetRecentAttacker(2f)) { if (current3 != null && current3.isLive && current3.isHero && this.IfChoose(current3)) { list.Add(current3); } } } } List <Units> list3 = FindTargetHelper.FilterTargets(this.m_Owner, list, FindType.Distance, this.m_Owner.GetAttackRange(null)); if (list3 != null && list3.Count > 0) { foreach (Units current4 in list3) { if (current4.isHero) { return(current4); } } return(list3[0]); } return(null); }
private List <int> GetShareUnits(Units target, float range) { List <int> list = new List <int>(); IList <Units> mapUnits = MapManager.Instance.GetMapUnits((TeamType)target.teamType, global::TargetTag.Hero); if (mapUnits != null) { foreach (Units current in mapUnits) { if (current.unique_id != target.unique_id) { if (UnitFeature.TargetInDistance(target.mTransform, current.mTransform, range)) { list.Add(current.unique_id); } } } } return(list); }