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); } }
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); } }