void DepthSort() { var st = new SortTool <UnitBase>(); foreach (var ub in _unitList) { st.AddItem((int)(ub.GetSortValue() * 100), ub); } var sortList = st.Sort(true); for (int i = 0; i < sortList.Length; i++) { sortList[i].SetSortValue(i); } }
private void CreateTargets() { var st = new SortTool <UnitBase>(); foreach (var vo in _lv.targets) { var ub = AddUnit(targetPrefab, vo.x, vo.y, false); st.AddItem((int)(ub.GetSortValue() * 100), ub); } var sortList = st.Sort(true); for (int i = 0; i < sortList.Length; i++) { sortList[i].SetSortValue(i + 1); } }