Beispiel #1
0
        public Team(Color Color, string Name, Sprite CaptureIcon)
        {
            TeamId = CurrentTeamId;
            CurrentTeamId++;

            this.Color       = Color;
            ProtectionColor  = new Color(Color.r, Color.g, Color.b, 0.5f);
            HealthBar        = new HealthBar(ExtraResources.BUNDLE, Name);
            Name             = Name.ToLowerInvariant();
            this.Name        = Name;
            this.CaptureIcon = CaptureIcon;

            ColorFormat = $"[{Color.ToHexRGBA()}]";
            var Arguments = new Dictionary <string, Func <string> > {
                { "%c", () => ColorFormat },
                { "%w", () => LanguageManager.Get($"m.team.{Name}.whom") }
            };

            _Enable = MakeTeamToggle(Name, "enable", Arguments, GROUP_TEAMS);
            _Enable.ValueChanged += (Sender, Args) => {
                if (!_Enable.GetValue())
                {
                    TeamAffinityController.TeamDisabled(this);
                }
            };
        }
Beispiel #2
0
        private static void modActivated()
        {
            PlayerControl player = PlayerControl.LocalPlayer;

            // Get new name and color from host
            player.CmdCheckName(SaveManager.PlayerName);
            player.CmdCheckColor(SaveManager.BodyColor);

            // Remember settings
            SaveManager.LastHat  = player.Data.HatId;
            SaveManager.LastPet  = player.Data.PetId;
            SaveManager.LastSkin = player.Data.SkinId;

            // Reset hat on begin
            AlternativeRpcSender.RpcSetHat(0);

            // Handle pet setting
            if (PetsAllowed.GetValue())
            {
                petsActivated();
            }
            else
            {
                petsDeactivated();
            }

            // Handle skin setting
            if (SkinsAllowed.GetValue())
            {
                skinsActivated();
            }
            else
            {
                skinsDeactivated();
            }
        }
Beispiel #3
0
        private void ConvertButton_OnClick(object sender, CancelEventArgs e)
        {
            PlayerControl currentTarget = DestroyableSingleton <HudManager> .Instance?.KillButton?.CurrentTarget;

            if (!currentTarget)
            {
                e.Cancel = true;

                return;
            }

            Rpc.Instance.Send(currentTarget.PlayerId);

            if (ConversionCooldown.GetValue())
            {
                PlayerControl.LocalPlayer.SetKillTimer(PlayerControl.GameOptions.KillCooldown);
            }
        }
Beispiel #4
0
        // Handling of mod activation / deactivation
        private static void ModActiveValueChanged(object sender, OptionValueChangedEventArgs e)
        {
            // Communicate change to other players
            if (AmongUsClient.Instance.AmHost)
            {
                CustomRpcSender.RpcSetModActive(ModActive.GetValue());
            }

            // Handle it ourselfes
            if (ModActive.GetValue())
            {
                modActivated();
            }
            else
            {
                modDeactivated();
            }
        }