Ejemplo n.º 1
0
        private void setJester(PlayerController jester)
        {
            RolePlayer JesterRolePlayer = new RolePlayer(jester, "Jester");

            JesterRolePlayer.RoleEjected.UseRoleEjected = true;

            jester.ClearTasks();
            jester.PlayerTaskObjects = new Il2CppSystem.Collections.Generic.List <PILBGHDHJLH>();

            var intro = JesterRolePlayer.RoleIntro;

            intro.UseRoleIntro    = true;
            intro.RoleNameColor   = new Color(0.74901960784f, 0, 1f);
            intro.BackgroundColor = new Color(127 / 255f, 0 / 255f, 186 / 255f);
            intro.RoleDescription =
                $"Trick the crewmates into thinking\n" +
                $"that you are an {Functions.ColorRed}Impostor[]\n";

            var outro = JesterRolePlayer.RoleOutro;

            outro.WinText         = "Victory";
            outro.WinTextColor    = new Color(175 / 255f, 43 / 255f, 237 / 255f);
            outro.BackgroundColor = new Color(127 / 255f, 0 / 255f, 186 / 255f);

            AllRolePlayers.Add(JesterRolePlayer);

            if (AllRolePlayers.Where(x => x.AmRolePlayer).Count() > 0)
            {
                foreach (var role in AllRolePlayers)
                {
                    role.PlayerController.PlayerControl.nameText.Color = new Color(0.74901960784f, 0, 1f);
                }
            }
        }
Ejemplo n.º 2
0
        private void setCleaner(PlayerController ctrl)
        {
            var role = new RolePlayer(ctrl, "Cleaner");

            role.RoleIntro.UseRoleIntro    = true;
            role.RoleIntro.BackgroundColor = new Color(0, 136 / 255f, 255 / 255f);
            role.RoleIntro.RoleNameColor   = new Color(0, 221 / 255f, 255 / 255f);
            role.RoleIntro.RoleDescription = "Help the [ff0000ff]Impostors[] by [0088ffff]cleaning []the [ff0000ff]crime scene[].";

            role.RoleEjected.UseRoleEjected = true;

            role.NameColor = new Color(0, 221 / 255f, 255 / 255f);

            role.NameColorVisible = PlayerController.LocalPlayer.PlayerData.IsImpostor;

            AllRolePlayers.Add(role);

            if (ctrl.IsLocalPlayer)
            {
                CleanStopwatch = new CustomStopwatch(true);
            }
        }
Ejemplo n.º 3
0
        public override void Loop()
        {
            base.Loop();

            string add = $"\nCleaner Role: {Functions.ColorPurple}Active[]\n[]Clean Cooldown: {Functions.ColorPurple}{CleanCooldown}s";

            if (!CheepsAmongUsMod.CheepsAmongUsMod.SettingsAddition.Contains(add) && Enabled)
            {
                CheepsAmongUsMod.CheepsAmongUsMod.SettingsAddition = CheepsAmongUsMod.CheepsAmongUsMod.SettingsAddition.Replace(prevAdd, "") + add;
            }
            else if (CheepsAmongUsMod.CheepsAmongUsMod.SettingsAddition.Contains(prevAdd) && !Enabled)
            {
                CheepsAmongUsMod.CheepsAmongUsMod.SettingsAddition = CheepsAmongUsMod.CheepsAmongUsMod.SettingsAddition.Replace(prevAdd, "");
            }

            prevAdd = add;

            if (AllRolePlayers.Count == 0)
            {
                return;
            }

            var cleaner = AllRolePlayers.First();

            if (PlayerController.LocalPlayer.PlayerData.IsImpostor)
            {
                cleaner.PlayerController.PlayerControl.nameText.Color = cleaner.NameColor;
            }

            if (!cleaner.AmRolePlayer)
            {
                return;
            }

            if (CleanButtonSprite == null)
            {
                CleanButtonSprite = Functions.LoadSpriteFromAssemblyResource(Assembly.GetExecutingAssembly(), "CleanerRoleGameMode.Assets.clean.png"); // Load sprite

                KillSprite = PlayerHudManager.HudManager.KillButton.renderer.sprite;

                PlayerHudManager.HudManager.KillButton.renderer.sprite = CleanButtonSprite;
            }

            if (CleanStopwatch.Elapsed.TotalSeconds < CleanCooldown)
            {
                PlayerHudManager.HudManager.KillButton.SetCoolDown(CleanCooldown - (float)CleanStopwatch.Elapsed.TotalSeconds, CleanCooldown);
            }
            else
            {
                PlayerHudManager.HudManager.KillButton.SetCoolDown(0, CleanCooldown);
            }

            #region ---------- Manage Dead Body Target ----------
            var bodies = UnityEngine.Object.FindObjectsOfType <DeadBody>();

            DeadBody closest = null;

            #region ----- Find closest body -----
            foreach (var body in bodies)
            {
                try
                {
                    var distToObject = Vector2.Distance(body.transform.position, PlayerController.LocalPlayer.GameObject.transform.position);

                    var prevDist = float.MaxValue;

                    if (closest != null)
                    {
                        prevDist = Vector2.Distance(closest.transform.position, PlayerController.LocalPlayer.GameObject.transform.position);
                    }

                    if (distToObject < prevDist)
                    {
                        closest = body;
                    }
                }
                catch { }
            }
            #endregion

            #region ----- If distance too large, set target to null -----
            if (closest != null)
            {
                if (Vector2.Distance(closest.transform.position, PlayerController.LocalPlayer.GameObject.transform.position) > CleanDistance)
                {
                    closest = null;
                }
            }
            #endregion

            #region ----- Remove outline from previous target -----
            if (Patching.Patch_KillButtonManager_PerformKill.TargetId != byte.MaxValue)
            {
                if (closest == null || Patching.Patch_KillButtonManager_PerformKill.TargetId != closest.ParentId)
                {
                    try
                    {
                        SetOutline(Patching.Patch_KillButtonManager_PerformKill.TargetId, Color.blue, false);
                    } catch { }
                }
            }
            #endregion

            if (closest != null)
            {
                Patching.Patch_KillButtonManager_PerformKill.TargetId = closest.ParentId; // update target
            }
            else
            {
                Patching.Patch_KillButtonManager_PerformKill.TargetId = byte.MaxValue;
            }

            if (closest != null)
            {
                SetOutline(closest.ParentId, Color.blue, true); // set target outline
                PlayerHudManager.HudManager.KillButton.renderer.color = EnabledColor;
                PlayerHudManager.HudManager.KillButton.renderer.material.SetFloat("_Desat", 0f);
            }
            else
            {
                PlayerHudManager.HudManager.KillButton.renderer.color = DisabledColor;
                PlayerHudManager.HudManager.KillButton.renderer.material.SetFloat("_Desat", 1f);
            }
            #endregion
        }