public static void randomColors() { // 発生確率 int random = rnd.Next(100); if (random > probability) { return; } var allPlayers = PlayerControl.AllPlayerControls; List <byte> alivePlayers = new List <byte>(); List <int> tempList = new List <int>(); foreach (var p in allPlayers) { if (p.PlayerId == PlayerControl.LocalPlayer.PlayerId) { continue; } if (p == Puppeteer.dummy) { continue; } if (p.isAlive()) { alivePlayers.Add(p.PlayerId); } } alivePlayers.shuffle(); List <byte> shuffleTargets = alivePlayers.Count > numShufflePlayers?alivePlayers.Take(numShufflePlayers).ToList() : alivePlayers; foreach (byte id in shuffleTargets) { if (id == PlayerControl.LocalPlayer.PlayerId) { continue; } var p = Helpers.playerById(id); int rnd; int coutner = 0; while (true) { rnd = TheOtherRoles.rnd.Next(shuffleTargets.Count); if (shuffleTargets[rnd] == PlayerControl.LocalPlayer.PlayerId) { continue; } if (!tempList.Contains(rnd)) { tempList.Add(rnd); break; } coutner++; } var to = Helpers.playerById((byte)shuffleTargets[rnd]); MorphHandler.morphToPlayer(p, to); } randomColorFlag = true; }
public static void resetColors() { var allPlayers = PlayerControl.AllPlayerControls; foreach (var p in allPlayers) { MorphHandler.morphToPlayer(p, p); } randomColorFlag = false; }
public override void OnKill(PlayerControl target) { // 死体を消す DeadBody[] array = UnityEngine.Object.FindObjectsOfType <DeadBody>(); for (int i = 0; i < array.Length; i++) { if (GameData.Instance.GetPlayerById(array[i].ParentId).PlayerId == target.PlayerId) { array[i].gameObject.active = false; } } MorphHandler.morphToPlayer(player, target); }