Exemple #1
0
    private void Insert(StatusEffect statusEffect, int start, int end)
    {
        if (start == end)
        {
            list.Insert(statusEffect.CompareTo(list[start]) < 0 ? start : start + 1, statusEffect);
            return;
        }

        int mid = (start + end + 1) / 2;

        int compare = statusEffect.CompareTo(list[mid]);

        if (compare < 0)
        {
            Insert(statusEffect, start, mid - 1);
        }
        else
        {
            Insert(statusEffect, mid, end);
        }
    }