Esempio n. 1
0
 void RandomizePlayers()
 {
     for (int index = 0; index < players.Length; index++)
     {
         OrganizedPlayer temp        = players[index];
         int             randomIndex = Random.Range(index, players.Length);
         players[index]       = players[randomIndex];
         players[randomIndex] = temp;
     }
 }
    public void MovePlayerToEndOfList( OrganizedPlayer playerToMove )
    {
        int indexOfPlayerToMove = -1;
        for( int index = 0; index < players.Length; index++ ) {
            if( players[index] == playerToMove ) indexOfPlayerToMove = index;
        }

        if( indexOfPlayerToMove != -1 ) {
            for( int index = indexOfPlayerToMove + 1; index < players.Length; index++ ) {
                players[index - 1] = players[index];
            }

            players[players.Length - 1] = playerToMove;
        }

        ReorganizePlayers();
    }
Esempio n. 3
0
    public void MovePlayerToEndOfList(OrganizedPlayer playerToMove)
    {
        int indexOfPlayerToMove = -1;

        for (int index = 0; index < players.Length; index++)
        {
            if (players[index] == playerToMove)
            {
                indexOfPlayerToMove = index;
            }
        }

        if (indexOfPlayerToMove != -1)
        {
            for (int index = indexOfPlayerToMove + 1; index < players.Length; index++)
            {
                players[index - 1] = players[index];
            }

            players[players.Length - 1] = playerToMove;
        }

        ReorganizePlayers();
    }