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; } }
public static void spawnDummy() { MessageWriter writer; if (dummy == null) { var playerId = (byte)GameData.Instance.GetAvailableId(); 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); } 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); // 暫定遅延実行 何故か透明化が解除されないため DestroyableSingleton <HudManager> .Instance.StartCoroutine(Effects.Lerp(0.25f, new Action <float>(p => { if (p == 1) { RPCProcedure.moveDummy(PlayerControl.LocalPlayer.transform.position); } }))); if (target != null) { writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.PuppeteerMorph, Hazel.SendOption.Reliable, -1); writer.Write(target.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.puppeteerMorph(target.PlayerId); } canSpawn = false; isActive = true; }