示例#1
0
 private void SortPlayersLeftToRight(PRAC_Def[] athletes)
 {
     for (int i = 2; i < athletes.Length; i++)
     {
         for (int j = i; j > 0; j--)
         {
             if (athletes[j].transform.position.x < athletes[j - 1].transform.position.x)
             {
                 PRAC_Def temp = athletes[j];
                 athletes[j]     = athletes[j - 1];
                 athletes[j - 1] = temp;
             }
         }
     }
 }
示例#2
0
    /************************
     * Receive all the defenders in man coverage. Then we sort them from most valuable to least, so we should never get
     * CB1 covering nobody while LB3 covers WR1.
     ********************* */
    public static List <PRAC_Def> FSORT_DEFENDER_IMPORTANCE(List <PRAC_Def> defsInMan)
    {
        for (int i = 1; i < defsInMan.Count; i++)
        {
            for (int j = i; j > 0; j--)
            {
                if (FGET_DEF_TAG_IMPORTANCE(defsInMan[j].mJob.mTag) < FGET_DEF_TAG_IMPORTANCE(defsInMan[j - 1].mJob.mTag))
                {
                    // Swap the pointers.
                    PRAC_Def temp = defsInMan[j];
                    defsInMan[j]     = defsInMan[j - 1];
                    defsInMan[j - 1] = temp;
                }
            }
        }

        return(defsInMan);
    }