示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }