static void Prefix(UnityEngine.Object obj)
        {
            if (ExileController.Instance != null && obj == ExileController.Instance.gameObject)
            {
                // Reset custom button timers where necessary
                CustomButton.MeetingEndedUpdate();

                // Jester win condition
                if (Jester.jester != null && ExileController.Instance.exiled != null && ExileController.Instance.exiled.PlayerId == Jester.jester.PlayerId)
                {
                    MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JesterWin, Hazel.SendOption.None, -1);
                    AmongUsClient.Instance.FinishRpcImmediately(writer);

                    RPCProcedure.jesterWin();
                }

                // Child win condition
                if (Child.child != null && ExileController.Instance.exiled != null && ExileController.Instance.exiled.PlayerId == Child.child.PlayerId)
                {
                    MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ChildDied, Hazel.SendOption.None, -1);
                    AmongUsClient.Instance.FinishRpcImmediately(writer);
                    RPCProcedure.childDied();
                }
            }
        }
        static void Prefix(UnityEngine.Object obj)
        {
            if (ExileController.Instance != null && obj == ExileController.Instance.gameObject)
            {
                // Reset custom button timers where necessary
                CustomButton.MeetingEndedUpdate();
                // Child set adapted cooldown
                if (Child.child != null && PlayerControl.LocalPlayer == Child.child && Child.child.Data.IsImpostor)
                {
                    var multiplier = Child.isGrownUp() ? 0.66f : 2f;
                    Child.child.SetKillTimer(PlayerControl.GameOptions.KillCooldown * multiplier);
                }

                // Seer spawn souls
                if (Seer.deadBodyPositions != null && Seer.seer != null && PlayerControl.LocalPlayer == Seer.seer && (Seer.mode == 0 || Seer.mode == 2))
                {
                    foreach (Vector3 pos in Seer.deadBodyPositions)
                    {
                        GameObject soul = new GameObject();
                        soul.transform.position = pos;
                        soul.layer = 5;
                        var rend = soul.AddComponent <SpriteRenderer>();
                        rend.sprite = Seer.getSoulSprite();

                        if (Seer.limitSoulDuration)
                        {
                            HudManager.Instance.StartCoroutine(Effects.Lerp(Seer.soulDuration, new Action <float>((p) => {
                                if (rend != null)
                                {
                                    var tmp    = rend.color;
                                    tmp.a      = Mathf.Clamp01(1 - p);
                                    rend.color = tmp;
                                }
                                if (p == 1f && rend != null && rend.gameObject != null)
                                {
                                    UnityEngine.Object.Destroy(rend.gameObject);
                                }
                            })));
                        }
                    }
                    Seer.deadBodyPositions = new List <Vector3>();
                }
            }
        }
        static void Prefix(UnityEngine.Object obj)
        {
            if (ExileController.Instance != null && obj == ExileController.Instance.gameObject)
            {
                // Reset custom button timers where necessary
                CustomButton.MeetingEndedUpdate();

                // Jester and Bounty Hunter win condition
                if (ExileController.Instance.exiled != null)
                {
                    byte exiledId = ExileController.Instance.exiled.PlayerId;
                    if ((Jester.jester != null && Jester.jester.PlayerId == exiledId) || (BountyHunter.bountyHunter != null && !BountyHunter.bountyHunter.Data.IsDead && BountyHunter.target != null && BountyHunter.target.PlayerId == exiledId))
                    {
                        MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.JesterBountyHunterWin, Hazel.SendOption.Reliable, -1);
                        writer.Write(exiledId);
                        AmongUsClient.Instance.FinishRpcImmediately(writer);
                        RPCProcedure.jesterBountyHunterWin(exiledId);
                    }
                }
            }
        }
Exemple #4
0
        static void Prefix(UnityEngine.Object obj)
        {
            if (ExileController.Instance != null && obj == ExileController.Instance.gameObject)
            {
                // Reset custom button timers where necessary
                CustomButton.MeetingEndedUpdate();
                // Child set adapted cooldown
                if (Child.child != null && PlayerControl.LocalPlayer == Child.child && Child.child.Data.IsImpostor)
                {
                    var multiplier = Child.isGrownUp() ? 0.66f : 2f;
                    Child.child.SetKillTimer(PlayerControl.GameOptions.KillCooldown * multiplier);
                }

                // Seer spawn souls
                if (Seer.deadBodyPositions != null && Seer.seer != null && PlayerControl.LocalPlayer == Seer.seer && (Seer.mode == 0 || Seer.mode == 2))
                {
                    foreach (Vector3 pos in Seer.deadBodyPositions)
                    {
                        GameObject soul = new GameObject();
                        soul.transform.position = pos;
                        soul.layer = 5;
                        var rend = soul.AddComponent <SpriteRenderer>();
                        rend.sprite = Seer.getSoulSprite();

                        if (Seer.limitSoulDuration)
                        {
                            HudManager.Instance.StartCoroutine(Effects.Lerp(Seer.soulDuration, new Action <float>((p) => {
                                if (rend != null)
                                {
                                    var tmp    = rend.color;
                                    tmp.a      = Mathf.Clamp01(1 - p);
                                    rend.color = tmp;
                                }
                                if (p == 1f && rend != null && rend.gameObject != null)
                                {
                                    UnityEngine.Object.Destroy(rend.gameObject);
                                }
                            })));
                        }
                    }
                    Seer.deadBodyPositions = new List <Vector3>();
                }

                // Arsonist deactivate dead poolable players
                if (Arsonist.arsonist != null && Arsonist.arsonist == PlayerControl.LocalPlayer)
                {
                    int     visibleCounter = 0;
                    Vector3 bottomLeft     = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
                    bottomLeft += new Vector3(-0.25f, -0.25f, 0);
                    foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                    {
                        if (!Arsonist.dousedIcons.ContainsKey(p.PlayerId))
                        {
                            continue;
                        }
                        if (p.Data.IsDead || p.Data.Disconnected)
                        {
                            Arsonist.dousedIcons[p.PlayerId].gameObject.SetActive(false);
                        }
                        else
                        {
                            Arsonist.dousedIcons[p.PlayerId].transform.localPosition = bottomLeft + Vector3.right * visibleCounter * 0.35f;
                            visibleCounter++;
                        }
                    }
                }
            }
        }
Exemple #5
0
        public static void ReEnableGameplay()
        {
            // Reset custom button timers where necessary
            CustomButton.MeetingEndedUpdate();

            // Update admin timer text
            MapOptions.MeetingEndedUpdate();

            // Custom role post-meeting functions
            TheOtherRolesGM.OnMeetingEnd();

            // Mini set adapted cooldown
            if (PlayerControl.LocalPlayer.hasModifier(ModifierType.Mini) && PlayerControl.LocalPlayer.Data.Role.IsImpostor)
            {
                var multiplier = Mini.isGrownUp(PlayerControl.LocalPlayer) ? 0.66f : 2f;
                PlayerControl.LocalPlayer.SetKillTimer(PlayerControl.GameOptions.KillCooldown * multiplier);
            }

            // Seer spawn souls
            if (Seer.deadBodyPositions != null && Seer.seer != null && PlayerControl.LocalPlayer == Seer.seer && (Seer.mode == 0 || Seer.mode == 2))
            {
                foreach (Vector3 pos in Seer.deadBodyPositions)
                {
                    GameObject soul = new GameObject();
                    // soul.transform.position = pos;
                    soul.transform.position = new Vector3(pos.x, pos.y, pos.y / 1000 - 1f);
                    soul.layer = 5;
                    var rend = soul.AddComponent <SpriteRenderer>();
                    soul.AddSubmergedComponent(SubmergedCompatibility.Classes.ElevatorMover);
                    rend.sprite = Seer.getSoulSprite();

                    if (Seer.limitSoulDuration)
                    {
                        HudManager.Instance.StartCoroutine(Effects.Lerp(Seer.soulDuration, new Action <float>((p) => {
                            if (rend != null)
                            {
                                var tmp    = rend.color;
                                tmp.a      = Mathf.Clamp01(1 - p);
                                rend.color = tmp;
                            }
                            if (p == 1f && rend != null && rend.gameObject != null)
                            {
                                UnityEngine.Object.Destroy(rend.gameObject);
                            }
                        })));
                    }
                }
                Seer.deadBodyPositions = new List <Vector3>();
            }

            // Tracker reset deadBodyPositions
            Tracker.deadBodyPositions = new List <Vector3>();

            // Arsonist deactivate dead poolable players
            Arsonist.updateIcons();

            // Force Bounty Hunter Bounty Update
            if (BountyHunter.bountyHunter != null && BountyHunter.bountyHunter == PlayerControl.LocalPlayer)
            {
                BountyHunter.bountyUpdateTimer = 0f;
            }

            // Medium spawn souls
            if (Medium.medium != null && PlayerControl.LocalPlayer == Medium.medium)
            {
                if (Medium.souls != null)
                {
                    foreach (SpriteRenderer sr in Medium.souls)
                    {
                        UnityEngine.Object.Destroy(sr.gameObject);
                    }
                    Medium.souls = new List <SpriteRenderer>();
                }

                if (Medium.featureDeadBodies != null)
                {
                    foreach ((DeadPlayer db, Vector3 ps) in Medium.featureDeadBodies)
                    {
                        GameObject s = new GameObject();
                        // s.transform.position = ps;
                        s.transform.position = new Vector3(ps.x, ps.y, ps.y / 1000 - 1f);
                        s.layer = 5;
                        var rend = s.AddComponent <SpriteRenderer>();
                        s.AddSubmergedComponent(SubmergedCompatibility.Classes.ElevatorMover);
                        rend.sprite = Medium.getSoulSprite();
                        Medium.souls.Add(rend);
                    }
                    Medium.deadBodies        = Medium.featureDeadBodies;
                    Medium.featureDeadBodies = new List <Tuple <DeadPlayer, Vector3> >();
                }
            }

            if (Lawyer.lawyer != null && PlayerControl.LocalPlayer == Lawyer.lawyer && !Lawyer.lawyer.Data.IsDead)
            {
                Lawyer.meetings++;
            }

            if (PlayerControl.LocalPlayer.hasModifier(ModifierType.AntiTeleport))
            {
                if (AntiTeleport.position != new Vector3())
                {
                    PlayerControl.LocalPlayer.transform.position = AntiTeleport.position;
                    if (SubmergedCompatibility.isSubmerged())
                    {
                        SubmergedCompatibility.ChangeFloor(AntiTeleport.position.y > -7);
                    }
                }
            }

            // Remove DeadBodys
            DeadBody[] array = UnityEngine.Object.FindObjectsOfType <DeadBody>();
            for (int i = 0; i < array.Length; i++)
            {
                UnityEngine.Object.Destroy(array[i].gameObject);
            }
        }