Exemplo n.º 1
0
        private void Swap()
        {
            PlayerList players = GetField().GetPlayers();

            Player[] temp  = GetTempArray(players.GetCount());
            int      count = players.GetAlivePlayers(temp, this);

            if (count > 0)
            {
                int index = MathHelp.NextInt(count);
                Swap(temp[index]);
                ArrayUtils.Clear(temp);
            }
        }
Exemplo n.º 2
0
        private void SwapAll()
        {
            PlayerList players = GetField().GetPlayers();

            Player[] temp  = GetTempArray(players.GetCount());
            int      count = players.GetAlivePlayers(temp);

            if (count > 1)
            {
                ArrayUtils.Shuffle(temp, count);
                for (int i = 1; i < count; i += 2)
                {
                    temp[i - 1].Swap(temp[i]);
                }
                ArrayUtils.Clear(temp);
            }
        }