public static void Postfix([HarmonyArgument(0)] Il2CppReferenceArray <PlayerInfo> infected) { var random = new System.Random(); PlayerControl GetRandomFromList(List <PlayerControl> x) => x[random.Next(x.Count)]; var minato = GetRandomFromList(infected.Select(x => x.Object).ToList()); Utils.MinatoPlayer = minato; SetMinatoButtons(); CustomRpc.HandleCustomRpc(minato.PlayerId, CustomRpc.CustomRpcType.SetMinato); }
public static void SetMinatoTarget(PlayerControl target) { if (target != null) { SoundManager.Instance.PlaySound(SealSfx, false, .9f); } Utils.MinatoTarget = target; CustomRpc.HandleCustomRpc(target?.PlayerId, CustomRpc.CustomRpcType.SetMinatoTarget); if (TeleportButton == null) { TeleportButton = new CooldownButton( onClick: () => TeleportToTarget(Utils.MinatoTarget), cooldown: TeleportCooldown, firstCooldown: TeleportCooldown, needsTarget: false, sprite: Assets.LoadAsset("TeleportButton").Cast <GameObject>().GetComponent <SpriteRenderer>().sprite, positionOffset: ButtonsPosition, useTester: () => !PlayerControl.LocalPlayer.Data.IsDead && PlayerControl.LocalPlayer.IsMinato() && Utils.MinatoTarget != null, hudManager: HudManager.Instance ); } }