Beispiel #1
0
        public static void Prefix(IntroCutscene __instance)
        {
            // Arsonist generate player icons
            if (PlayerControl.LocalPlayer != null && PlayerControl.LocalPlayer == Arsonist.arsonist && HudManager.Instance != null)
            {
                int     playerCounter = 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 player in PlayerControl.AllPlayerControls)
                {
                    if (player != PlayerControl.LocalPlayer)
                    {
                        GameData.PlayerInfo data           = player.Data;
                        PoolablePlayer      poolablePlayer = UnityEngine.Object.Instantiate <PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform);
                        poolablePlayer.transform.localPosition = bottomLeft + Vector3.right * playerCounter * 0.35f;
                        poolablePlayer.transform.localScale    = Vector3.one * 0.3f;
                        PlayerControl.SetPlayerMaterialColors(data.ColorId, poolablePlayer.Body);
                        DestroyableSingleton <HatManager> .Instance.SetSkin(poolablePlayer.SkinSlot, data.SkinId);

                        poolablePlayer.HatSlot.SetHat(data.HatId, data.ColorId);
                        PlayerControl.SetPetImage(data.PetId, data.ColorId, poolablePlayer.PetSlot);
                        poolablePlayer.NameText.text = data.PlayerName;
                        poolablePlayer.SetFlipX(true);
                        poolablePlayer.setSemiTransparent(true);
                        Arsonist.dousedIcons[player.PlayerId] = poolablePlayer;
                        playerCounter++;
                    }
                }
            }
        }
Beispiel #2
0
        public static void Prefix(IntroCutscene __instance)
        {
            // Generate and initialize player icons
            if (PlayerControl.LocalPlayer != null && HudManager.Instance != null)
            {
                Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
                foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                {
                    GameData.PlayerInfo data   = p.Data;
                    PoolablePlayer      player = UnityEngine.Object.Instantiate <PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform);
                    player.UpdateFromPlayerOutfit(p.Data.DefaultOutfit, p.Data.IsDead);
                    player.SetFlipX(true);
                    player.PetSlot.gameObject.SetActive(false);
                    player.NameText.text = p.Data.DefaultOutfit.PlayerName;
                    MapOptions.playerIcons[p.PlayerId] = player;

                    if (PlayerControl.LocalPlayer == BountyHunter.bountyHunter)
                    {
                        player.transform.localPosition = bottomLeft + new Vector3(-0.25f, 0f, 0);
                        player.transform.localScale    = Vector3.one * 0.4f;
                        player.gameObject.SetActive(false);
                    }
                    else if (PlayerControl.LocalPlayer == GM.gm)
                    {
                        player.transform.localPosition = Vector3.zero;
                        player.transform.localScale    = Vector3.one * 0.3f;
                        player.setSemiTransparent(false);
                        player.gameObject.SetActive(false);
                    }
                    else
                    {
                        player.gameObject.SetActive(false);
                    }
                }
            }

            // Force Bounty Hunter to load a new Bounty when the Intro is over
            if (BountyHunter.bounty != null && PlayerControl.LocalPlayer == BountyHunter.bountyHunter)
            {
                BountyHunter.bountyUpdateTimer = 0f;
                if (HudManager.Instance != null)
                {
                    Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z) + new Vector3(-0.25f, 1f, 0);
                    BountyHunter.cooldownText           = UnityEngine.Object.Instantiate <TMPro.TextMeshPro>(HudManager.Instance.KillButton.cooldownTimerText, HudManager.Instance.transform);
                    BountyHunter.cooldownText.alignment = TMPro.TextAlignmentOptions.Center;
                    BountyHunter.cooldownText.transform.localPosition = bottomLeft + new Vector3(0f, -1f, -1f);
                    BountyHunter.cooldownText.gameObject.SetActive(true);
                }
            }

            Arsonist.updateIcons();
            Morphling.resetMorph();
            Camouflager.resetCamouflage();

            if (PlayerControl.LocalPlayer == GM.gm && !GM.hasTasks)
            {
                PlayerControl.LocalPlayer.clearAllTasks();
            }

            if (PlayerControl.LocalPlayer.isGM())
            {
                HudManager.Instance.ShadowQuad.gameObject.SetActive(false);
                HudManager.Instance.ReportButton.gameObject.SetActiveRecursively(false);
                HudManager.Instance.ReportButton.SetActive(false);
                HudManager.Instance.ReportButton.graphic.enabled         = false;
                HudManager.Instance.ReportButton.enabled                 = false;
                HudManager.Instance.ReportButton.graphic.sprite          = null;
                HudManager.Instance.ReportButton.buttonLabelText.enabled = false;
                HudManager.Instance.ReportButton.buttonLabelText.SetText("");

                HudManager.Instance.roomTracker.gameObject.SetActiveRecursively(false);
                HudManager.Instance.roomTracker.text.enabled = false;
                HudManager.Instance.roomTracker.text.SetText("");
                HudManager.Instance.roomTracker.enabled = false;
            }

            // ベントを追加する
            AdditionalVents.AddAdditionalVents();

            // スペシメンにバイタルを移動する
            SpecimenVital.moveVital();

            //タスクバグ修正
            if (PlayerControl.GameOptions.MapId == 4 && CustomOptionHolder.airshipEnableWallCheck.getBool())
            {
                var objects = UnityEngine.GameObject.FindObjectsOfType <Console>().ToList();
                objects.Find(x => x.name == "task_garbage1").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage2").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage3").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage4").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage5").checkWalls      = true;
                objects.Find(x => x.name == "task_shower").checkWalls        = true;
                objects.Find(x => x.name == "task_developphotos").checkWalls = true;
                objects.Find(x => x.name == "DivertRecieve" && x.Room == SystemTypes.Armory).checkWalls   = true;
                objects.Find(x => x.name == "DivertRecieve" && x.Room == SystemTypes.MainHall).checkWalls = true;
            }

            // 最初から一人の場合はLast Impostorになる
            if (AmongUsClient.Instance.AmHost)
            {
                LastImpostor.promoteToLastImpostor();
            }

            // タスクパネルの表示優先度を上げる
            var taskPanel = DestroyableSingleton <HudManager> ._instance.TaskStuff;
            var pos       = taskPanel.transform.position;

            taskPanel.transform.position = new Vector3(pos.x, pos.y, -20);

            // ダミー人形をスポーンさせておく
            if (PlayerControl.LocalPlayer.isRole(RoleType.Puppeteer) && SubmergedCompatibility.isSubmerged())
            {
                var           playerId = (byte)GameData.Instance.GetAvailableId();
                MessageWriter writer   = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SpawnDummy, Hazel.SendOption.Reliable, -1);
                writer.Write(playerId);
                writer.Write(PlayerControl.LocalPlayer.transform.position.x);
                writer.Write(PlayerControl.LocalPlayer.transform.position.y);
                writer.Write(PlayerControl.LocalPlayer.transform.position.z);
                AmongUsClient.Instance.FinishRpcImmediately(writer);
                RPCProcedure.spawnDummy(playerId, PlayerControl.LocalPlayer.transform.position);
            }
        }