Ejemplo n.º 1
0
        public static void switchStealth(bool flag)
        {
            if (!flag)
            {
                MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PuppeteerStealth, Hazel.SendOption.Reliable, -1);
                writer.Write(false);
                AmongUsClient.Instance.FinishRpcImmediately(writer);
                RPCProcedure.puppeteerStealth(false);
                var hudManager = DestroyableSingleton <HudManager> .Instance;
                hudManager.PlayerCam.SetTarget(PlayerControl.LocalPlayer);
                senrigan(false);
                var player = PlayerControl.LocalPlayer;
                player.myLight = UnityEngine.Object.Instantiate <LightSource>(player.LightPrefab);
                player.myLight.transform.SetParent(player.transform);
                player.myLight.transform.localPosition = player.Collider.offset;
                PlayerControl.LocalPlayer.moveable     = true;
            }
            else
            {
                // 常に自身の位置から人形をスタートさせる
                MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.MoveDummy, Hazel.SendOption.Reliable, -1);
                writer.Write(PlayerControl.LocalPlayer.transform.position.x);
                writer.Write(PlayerControl.LocalPlayer.transform.position.y);
                writer.Write(PlayerControl.LocalPlayer.transform.position.z);
                writer.Write(true);
                AmongUsClient.Instance.FinishRpcImmediately(writer);
                RPCProcedure.moveDummy(PlayerControl.LocalPlayer.transform.position);

                writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PuppeteerStealth, Hazel.SendOption.Reliable, -1);
                writer.Write(true);
                AmongUsClient.Instance.FinishRpcImmediately(writer);
                RPCProcedure.puppeteerStealth(true);
                var hudManager = DestroyableSingleton <HudManager> .Instance;
                var dummy      = Puppeteer.dummy;
                hudManager.PlayerCam.SetTarget(dummy);
                if (losesSenriganOnDeath)
                {
                    bool isAlive = Puppeteer.allPlayers.FindAll(x => x.isAlive()).Count >= 1;
                    senrigan(isAlive);
                }
                else
                {
                    senrigan(true);
                }
                dummy.myLight = UnityEngine.Object.Instantiate <LightSource>(dummy.LightPrefab);
                dummy.myLight.transform.SetParent(dummy.transform);
                dummy.myLight.transform.localPosition = dummy.Collider.offset;
                PlayerControl.LocalPlayer.NetTransform.Halt();
                PlayerControl.LocalPlayer.moveable = false;
            }
        }