Microphones and silencers sync properly now.

This commit is contained in:
Jamie Greunbaum 2025-12-08 19:28:46 -05:00
parent b6921d760a
commit 14e8d806d2
4 changed files with 10 additions and 5 deletions

View File

@ -1,7 +1,9 @@
 
using System.Runtime.InteropServices;
using UdonSharp; using UdonSharp;
using UnityEngine; using UnityEngine;
using VRC.SDK3.Data; using VRC.SDK3.Data;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase; using VRC.SDKBase;
using VRC.Udon.Common.Interfaces; using VRC.Udon.Common.Interfaces;
@ -111,19 +113,21 @@ public class GameManagerBase : UdonSharpBehaviour
_AllowInteractionFromHostCard = true; _AllowInteractionFromHostCard = true;
EnablePlayerMicrophone(true); SendCustomNetworkEvent(NetworkEventTarget.All, nameof(EnablePlayerMicrophone), true);
} }
public virtual void DeinitialiseGameMode() public virtual void DeinitialiseGameMode()
{ {
EnablePlayerMicrophone(false); SendCustomNetworkEvent(NetworkEventTarget.All, nameof(EnablePlayerMicrophone), false);
} }
[NetworkCallable]
public void EnablePlayerMicrophone(bool Enable) public void EnablePlayerMicrophone(bool Enable)
{ {
_PlayerMicrophone.gameObject.SetActive(Enable); _PlayerMicrophone.gameObject.SetActive(Enable);
} }
[NetworkCallable]
public void EnableAudienceSilencer(bool Enable) public void EnableAudienceSilencer(bool Enable)
{ {
_AudienceSilencer.gameObject.SetActive(Enable); _AudienceSilencer.gameObject.SetActive(Enable);

View File

@ -72,7 +72,7 @@ public class GameManagerRound1 : GameManagerBase
_Modem.Activate(false); _Modem.Activate(false);
_ArrivalDisplay.Activate(false); _ArrivalDisplay.Activate(false);
EnableAudienceSilencer(true); SendCustomNetworkEvent(NetworkEventTarget.All, nameof(EnableAudienceSilencer), true);
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "PlayMusic", MusicEventType.WhereInTheWorld); _AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "PlayMusic", MusicEventType.WhereInTheWorld);
SendCustomEventDelayedSeconds(nameof(PlaySecondPartOfThemeMusic), 3.6666666666f); SendCustomEventDelayedSeconds(nameof(PlaySecondPartOfThemeMusic), 3.6666666666f);

View File

@ -56,7 +56,7 @@ public class GameManagerRound2 : GameManagerBase
_JailPlayer.PlayVideo = false; _JailPlayer.PlayVideo = false;
EnableAudienceSilencer(true); SendCustomNetworkEvent(NetworkEventTarget.All, nameof(EnableAudienceSilencer), true);
RequestSerialization(); RequestSerialization();
} }
@ -65,6 +65,7 @@ public class GameManagerRound2 : GameManagerBase
{ {
_JailPlayer.PlayVideo = false; _JailPlayer.PlayVideo = false;
_JailPhone.Activate = false; _JailPhone.Activate = false;
_JailChain.Show = false;
base.DeinitialiseGameMode(); base.DeinitialiseGameMode();
} }

View File

@ -74,7 +74,7 @@ public class GameManagerRound3 : GameManagerBase
InitialiseMarkers(); InitialiseMarkers();
GetCurrentMap().RandomiseCountries(); GetCurrentMap().RandomiseCountries();
EnableAudienceSilencer(false); SendCustomNetworkEvent(NetworkEventTarget.All, nameof(EnableAudienceSilencer), false);
RequestSerialization(); RequestSerialization();
} }