- Location board orientation corrected to properly match Unity axes.

- Markers are no longer thrown when dropped while walking.
- Markers stay much more stable and are far less prone to falling over.
- Rounds 2 and 3 properly sync to other clients.
This commit is contained in:
Jamie Greunbaum
2025-06-26 17:09:42 -04:00
parent 4fad27ce19
commit 05cf67b1e2
57 changed files with 6220 additions and 4425 deletions
@@ -1,12 +1,9 @@
using System.Runtime.InteropServices.WindowsRuntime;
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Data;
using VRC.SDK3.StringLoading;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase;
using VRC.Udon;
using VRC.Udon.Common.Interfaces;
@@ -222,23 +222,17 @@ public class GameManagerRound2 : GameManagerBase
public void PlayTheLoot()
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager,
NetworkEventTarget.All,
"PlaySFX", SFXEventType.TheLoot);
_AudioManager.PlaySFX(SFXEventType.TheLoot);
}
public void PlayTheWarrant()
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager,
NetworkEventTarget.All,
"PlaySFX", SFXEventType.TheWarrant);
_AudioManager.PlaySFX(SFXEventType.TheWarrant);
}
public void PlayTheCrookTheme()
{
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager,
NetworkEventTarget.All,
"PlayCrookTheme", _CaseManager.GetCrook());
_AudioManager.PlayCrookTheme(_CaseManager.GetCrook());
}
@@ -445,8 +445,8 @@ MonoBehaviour:
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
@@ -458,7 +458,13 @@ MonoBehaviour:
Data: 30|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Data: 1
- Name:
Entry: 7
Data: 31|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
@@ -479,13 +485,13 @@ MonoBehaviour:
Data: _ContinentData
- Name: $v
Entry: 7
Data: 31|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ContinentData
- Name: <UserType>k__BackingField
Entry: 7
Data: 32|System.RuntimeType, mscorlib
Data: 33|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Data.DataDictionary, VRCSDK3
@@ -494,7 +500,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 32
Data: 33
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -509,7 +515,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 34|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -533,7 +539,7 @@ MonoBehaviour:
Data: _StageIndex
- Name: $v
Entry: 7
Data: 34|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _StageIndex
@@ -547,8 +553,8 @@ MonoBehaviour:
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
@@ -557,10 +563,16 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 35|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 36|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Data: 1
- Name:
Entry: 7
Data: 37|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
@@ -581,13 +593,13 @@ MonoBehaviour:
Data: _GameStatus
- Name: $v
Entry: 7
Data: 36|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _GameStatus
- Name: <UserType>k__BackingField
Entry: 7
Data: 37|System.RuntimeType, mscorlib
Data: 39|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: GameStatus, Assembly-CSharp
@@ -601,56 +613,8 @@ MonoBehaviour:
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _Timer
- Name: $v
Entry: 7
Data: 39|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _Timer
- Name: <UserType>k__BackingField
Entry: 9
Data: 29
- Name: <SystemType>k__BackingField
Entry: 9
Data: 29
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
@@ -662,7 +626,67 @@ MonoBehaviour:
Data: 40|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Data: 1
- Name:
Entry: 7
Data: 41|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _Timer
- Name: $v
Entry: 7
Data: 42|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _Timer
- Name: <UserType>k__BackingField
Entry: 9
Data: 29
- Name: <SystemType>k__BackingField
Entry: 9
Data: 29
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 44|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
@@ -683,7 +707,7 @@ MonoBehaviour:
Data: _SuccessCounter
- Name: $v
Entry: 7
Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _SuccessCounter
@@ -697,8 +721,8 @@ MonoBehaviour:
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
@@ -707,10 +731,16 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 42|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 46|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Data: 1
- Name:
Entry: 7
Data: 47|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
@@ -731,7 +761,7 @@ MonoBehaviour:
Data: _FailureCounter
- Name: $v
Entry: 7
Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _FailureCounter
@@ -745,8 +775,8 @@ MonoBehaviour:
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
@@ -755,10 +785,16 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 44|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 49|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Data: 1
- Name:
Entry: 7
Data: 50|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
@@ -3,6 +3,7 @@ using UdonSharp;
using UnityEngine;
using VRC.SDK3.Data;
using VRC.SDK3.UdonNetworkCalling;
using VRC.Udon.Common.Interfaces;
public enum ContinentMap
@@ -35,17 +36,17 @@ public class GameManagerRound3 : GameManagerBase
[SerializeField] private AudioManager _AudioManager;
private ContinentMap _ActiveMap = ContinentMap.Africa;
[UdonSynced] private ContinentMap _ActiveMap = ContinentMap.Africa;
private DataDictionary _ContinentData;
private int _StageIndex = 0;
[UdonSynced] private int _StageIndex = 0;
private GameStatus _GameStatus = GameStatus.Pregame;
private int _Timer = TIMER_LENGTH;
[UdonSynced] private GameStatus _GameStatus = GameStatus.Pregame;
[UdonSynced] private int _Timer = TIMER_LENGTH;
private const float LENGTH_OF_ONE_SECOND = 1.04444444444444444f;
private const int TIMER_LENGTH = 45;
private int _SuccessCounter = 0;
private int _FailureCounter = 0;
[UdonSynced] private int _SuccessCounter = 0;
[UdonSynced] private int _FailureCounter = 0;
private const int MAX_FAILURE_COUNT = 2;
private const int MAX_SUCCESS_COUNT = 8;
@@ -73,7 +74,10 @@ public class GameManagerRound3 : GameManagerBase
}
}
GetCurrentMap().RandomiseCountries();
FloorMap CurrentMap = GetCurrentMap();
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)CurrentMap,
NetworkEventTarget.Owner,
"RandomiseCountries");
}
else
{
@@ -98,18 +102,24 @@ public class GameManagerRound3 : GameManagerBase
{
UpdateInterface();
GetCurrentMarker().EnablePickup(true);
FloorMapMarker Marker = GetCurrentMarker();
Marker.EnablePickup(true);
Marker.LocationFindingEnabled = true;
StartTimer();
}
private void StartTimer()
{
_AudioManager.PlayMusicLoop(MusicEventType.CarmenChaseMusic);
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager,
NetworkEventTarget.All,
"PlayMusicLoop", MusicEventType.CarmenChaseMusic);
_GameStatus = GameStatus.Begin;
_Timer = TIMER_LENGTH;
SendCustomEventDelayedSeconds(nameof(TickTimer), LENGTH_OF_ONE_SECOND);
RequestSerialization();
}
public void TickTimer()
@@ -117,29 +127,39 @@ public class GameManagerRound3 : GameManagerBase
_Timer--;
if (_Timer < 0)
{
GameHasBeenLost();
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this,
NetworkEventTarget.Owner,
nameof(GameHasBeenLost), false);
return;
}
SendCustomEventDelayedSeconds(nameof(TickTimer), LENGTH_OF_ONE_SECOND);
RequestSerialization();
}
public void CorrectResponse()
{
PlayCorrectSound();
GetCurrentMarker().EnablePickup(false);
FloorMapMarker Marker = GetCurrentMarker();
Marker.EnablePickup(false);
Marker.LocationFindingEnabled = false;
_FailureCounter = 0;
_SuccessCounter++;
if (_SuccessCounter >= MAX_SUCCESS_COUNT)
{
GameHasBeenWon();
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this,
NetworkEventTarget.Owner,
nameof(GameHasBeenWon));
}
else
{
SetUpNextCountry();
}
RequestSerialization();
}
public void IncorrectResponse()
@@ -148,7 +168,9 @@ public class GameManagerRound3 : GameManagerBase
if (_FailureCounter >= MAX_FAILURE_COUNT)
{
_FailureCounter = 0;
GetCurrentMarker().EnablePickup(false);
FloorMapMarker Marker = GetCurrentMarker();
Marker.EnablePickup(false);
Marker.LocationFindingEnabled = false;
SetUpNextCountry();
}
@@ -183,13 +205,17 @@ public class GameManagerRound3 : GameManagerBase
if (NextCountry < 0)
{
// If we ran out of countries, lose the game here.
GameHasBeenLost(true);
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this,
NetworkEventTarget.Owner,
nameof(GameHasBeenLost), true);
return;
}
_Markers[NextCountry].EnablePickup(true);
_Markers[NextCountry].LocationFindingEnabled = true;
UpdateInterface();
}
[NetworkCallable]
public void GameHasBeenWon()
{
if ((int)_GameStatus <= (int)GameStatus.Begin)
@@ -200,11 +226,14 @@ public class GameManagerRound3 : GameManagerBase
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
GameWinInterface.HeaderUI.text = "The player has won the game. " + _Timer + " seconds to spare.";
_AudioManager.PlayMusicLoop(MusicEventType.CarmenSandiegoWindDown);
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager,
NetworkEventTarget.All,
"PlayMusicLoop", MusicEventType.CarmenSandiegoWindDown);
}
}
public void GameHasBeenLost(bool RanOutOfMarkers = false)
[NetworkCallable]
public void GameHasBeenLost(bool RanOutOfMarkers)
{
if ((int)_GameStatus != (int)GameStatus.Win)
{
@@ -219,7 +248,9 @@ public class GameManagerRound3 : GameManagerBase
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
GameLossInterface.HeaderUI.text = "The player has lost. " + _SuccessCounter + " countries in " + TIMER_LENGTH + " seconds.";
_AudioManager.StopMusic();
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager,
NetworkEventTarget.All,
"StopMusic");
}
}
@@ -229,6 +260,8 @@ public class GameManagerRound3 : GameManagerBase
{
_GameStatus = NewStatus;
}
RequestSerialization();
}