Exemple #1
0
            public PlayerControl GetTarget(bool Active)
            {
                var Infected = ZombieRole.INSTANCE.Infected;

                PlayerTools.CalculateClosest(PlayerControl.LocalPlayer,
                                             out var ClosestPlayer, out var ClosestDistance,
                                             SomePlayer => !Infected.Contains(SomePlayer.PlayerId));

                return(Active && ClosestDistance.IsInKillRange()
                                        ? ClosestPlayer
                                        : null);
            }
Exemple #2
0
        public static PlayerControl GetTarget(bool Active, bool Friendly)
        {
            if (!Active || PlayerControl.LocalPlayer.inVent)
            {
                return(null);
            }

            PlayerTools.CalculateClosest(PlayerControl.LocalPlayer,
                                         out var ClosestPlayer, out var ClosestDistance,
                                         SomePlayer => {
                var Extra = SomePlayer.Extra();

                return((Friendly
                                                       ? Extra.Team == MilitaryTargeterStatics.PlayerTeam
                                                       : Extra.Team != MilitaryTargeterStatics.PlayerTeam) &&
                       Extra.IsReady());
            });
Exemple #3
0
        public static void Postfix(HudManager __instance)
        {
            if (AmongUsClient.Instance.GameState != InnerNetClient.GameStates.Started)
            {
                return;
            }

            if (!__instance.Chat.isActiveAndEnabled)
            {
                __instance.Chat.SetVisible(true);
            }

            var LocalPlayer = PlayerControl.LocalPlayer;
            var Dead        = LocalPlayer.Data.IsDead;

            KeyboardController.Update();

            var UseButtonActiveEnabled = __instance.UseButton != null &&
                                         __instance.UseButton.isActiveAndEnabled;

            PlayerTools.CalculateClosest(PlayerControl.LocalPlayer);

            foreach (var Role in Role.ROLES)
            {
                Role.PreUpdate(__instance, UseButtonActiveEnabled, Dead);
            }

            #region FILL_NAME

            foreach (var Player in PlayerControl.AllPlayerControls)
            {
                Player.nameText.Color = Color.white;
            }

            if (PlayerControl.LocalPlayer.Data.IsImpostor)
            {
                foreach (var player in PlayerControl.AllPlayerControls)
                {
                    if (player.Data.IsImpostor)
                    {
                        player.nameText.Color = Color.red;
                    }
                }
            }

            foreach (var Role in Role.ROLES)
            {
                Role.FillPlayerName();
            }

            #endregion

            foreach (var Role in Role.ROLES)
            {
                Role.PostUpdate(__instance, UseButtonActiveEnabled, Dead);
            }

            foreach (var Role in Role.ROLES)
            {
                Role.UpdateTasksVisual(__instance);
            }
        }
Exemple #4
0
        public static void Postfix(HudManager __instance)
        {
            if (AmongUsClient.Instance.GameState != InnerNetClient.GameStates.Started)
            {
                foreach (var Control in PlayerControl.AllPlayerControls)
                {
                    Control.nameText.Color = Color.white;
                }

                if (!Military.TeamAffinity.GetValue())
                {
                    return;
                }

                foreach (var(Team, Players) in TeamAffinityController.GetAffinities())
                {
                    foreach (var Player in Players.Select(PlayerTools.GetPlayerById))
                    {
                        Player.nameText.Color = Team.Color;
                    }
                }

                return;
            }

            if (!__instance.Chat.isActiveAndEnabled)
            {
                __instance.Chat.SetVisible(true);
            }

            var Scroll = Input.GetAxis("Mouse ScrollWheel");

            if (Scroll < 0)
            {
                GunController.PreviousGun();
            }
            else if (Scroll > 0)
            {
                GunController.NextGun();
            }

            var LocalPlayer = PlayerControl.LocalPlayer;
            var Dead        = LocalPlayer.Data.IsDead;

            KeyboardController.Update();

            var UseButtonActiveEnabled = __instance.UseButton != null &&
                                         __instance.UseButton.isActiveAndEnabled;

            PlayerTools.CalculateClosest(PlayerControl.LocalPlayer);

            foreach (var Role in Role.ROLES)
            {
                Role.PreUpdate(__instance, UseButtonActiveEnabled, Dead);
            }

            foreach (var Role in Role.ROLES)
            {
                Role.PostUpdate(__instance, UseButtonActiveEnabled, Dead);
            }

            __instance.ReportButton.gameObject.SetActive(false);
            GameMode.Current?.Update(Time.deltaTime);

            ModActions.Update();

            foreach (var Control in PlayerControl.AllPlayerControls)
            {
                var Extra = Control.Extra();
                if (Extra.Team == null)
                {
                    continue;
                }

                var Protection = !Extra.IsReady();
                var Color      = Protection ? PROTECTION : NO_PROTECTION;

                Control.nameText.Color = Protection
                                        ? Extra.Team.ProtectionColor
                                        : Extra.Team.Color;

                Extra.SetHealthBarActive(!Protection);
                Control.myRend.color      = Color;
                Control.HatRenderer.color = Color;

                Control.CurrentPet.rend.color = Color;
                if (Control.CurrentPet.shadowRend != null)
                {
                    Control.CurrentPet.shadowRend.color = Color;
                }

                Control.MyPhysics.Skin.layer.color = Color;

                Extra.Update();
            }
        }