Ejemplo n.º 1
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);
            }
        }