Adding player tracking as we work our way to making round 3 markers better.
This commit is contained in:
@@ -44,7 +44,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 15
|
||||
Data: 16
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
@@ -872,16 +872,76 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _CaseFileDictionary
|
||||
Data: _CurrentWinningPlayers
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 55|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CaseFileDictionary
|
||||
Data: _CurrentWinningPlayers
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 56|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: System.String[], mscorlib
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 56
|
||||
- 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: 57|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 58|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: _CaseFileDictionary
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 59|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CaseFileDictionary
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 60|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: VRC.SDK3.Data.DataDictionary, VRCSDK3
|
||||
@@ -890,7 +950,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 56
|
||||
Data: 60
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -905,7 +965,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 57|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 61|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
|
||||
@@ -47,6 +47,8 @@ public class CaseManager : UdonSharpBehaviour
|
||||
[UdonSynced] private string _CaseDescription = "";
|
||||
[UdonSynced] private string _StolenLoot = "";
|
||||
[UdonSynced] private AccusedCrook _AccusedCrook = AccusedCrook.INDEX_MAX;
|
||||
|
||||
[UdonSynced] private string[] _CurrentWinningPlayers = new string[3];
|
||||
|
||||
private DataDictionary _CaseFileDictionary;
|
||||
|
||||
@@ -111,7 +113,7 @@ public class CaseManager : UdonSharpBehaviour
|
||||
ErrorString = "Ensure the 'Round 3' dictionary entry is a dictionary with a key called 'Continent' and an integer value.";
|
||||
}
|
||||
|
||||
ContinueToRound2();
|
||||
ContinueToRound3();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -204,6 +206,13 @@ public class CaseManager : UdonSharpBehaviour
|
||||
}
|
||||
|
||||
|
||||
public void SetCurrentWinningPlayers(string[] NewWinners)
|
||||
{
|
||||
_CurrentWinningPlayers = NewWinners;
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
|
||||
public string CrookToString(AccusedCrook Crook)
|
||||
{
|
||||
switch (Crook)
|
||||
|
||||
@@ -852,25 +852,31 @@ public class GameManagerRound1 : GameManagerBase
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] WinningPlayers = new string[2];
|
||||
|
||||
if (SortedPlayerScores[0] == SortedPlayerScores[1])
|
||||
{
|
||||
// Randomly choose which player gets the first turn in the next round.
|
||||
Random.InitState(Networking.GetServerTimeInMilliseconds());
|
||||
|
||||
VRCPlayerApi[] Randomiser = new VRCPlayerApi[2];
|
||||
Randomiser[0] = Number1;
|
||||
Randomiser[1] = Number2;
|
||||
int RandomIndex = Random.Range(0, 2);
|
||||
Randomiser[RandomIndex].SetPlayerTag("Round1State", "FirstPlace");
|
||||
|
||||
WinningPlayers[0] = Randomiser[RandomIndex].displayName;
|
||||
WinningPlayers[1] = Randomiser[(RandomIndex + 1) % 2].displayName;
|
||||
|
||||
Interface.HeaderUI.text = Number1.displayName + " and " + Number2.displayName + " are tied for first place; both will move on to the next round.";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Tag first place player as first place.
|
||||
Number1.SetPlayerTag("Round1State", "FirstPlace");
|
||||
WinningPlayers[0] = Number1.displayName;
|
||||
WinningPlayers[1] = Number2.displayName;
|
||||
|
||||
Interface.HeaderUI.text = Number1.displayName + " and " + Number2.displayName + " will move on to the next round.";
|
||||
}
|
||||
|
||||
_CaseManager.SetCurrentWinningPlayers(WinningPlayers);
|
||||
}
|
||||
|
||||
return TiebreakerNeeded;
|
||||
|
||||
@@ -44,7 +44,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 13
|
||||
Data: 12
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
@@ -759,60 +759,6 @@ MonoBehaviour:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _FailureCounter
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _FailureCounter
|
||||
- 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: 50|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 51|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: 13
|
||||
Data:
|
||||
|
||||
@@ -48,8 +48,6 @@ public class GameManagerRound3 : GameManagerBase
|
||||
private const int TIMER_LENGTH = 45;
|
||||
|
||||
[UdonSynced] private int _SuccessCounter = 0;
|
||||
[UdonSynced] private int _FailureCounter = 0;
|
||||
private const int MAX_FAILURE_COUNT = 2;
|
||||
private const int MAX_SUCCESS_COUNT = 8;
|
||||
|
||||
|
||||
@@ -57,7 +55,6 @@ public class GameManagerRound3 : GameManagerBase
|
||||
{
|
||||
_StageIndex = 0;
|
||||
_SuccessCounter = 0;
|
||||
_FailureCounter = 0;
|
||||
_Timer = TIMER_LENGTH;
|
||||
|
||||
for (int i = 0; i < _Markers.Length; i++)
|
||||
@@ -121,10 +118,7 @@ public class GameManagerRound3 : GameManagerBase
|
||||
|
||||
public void BeginRound()
|
||||
{
|
||||
NetworkCalling.SendCustomNetworkEvent(
|
||||
(IUdonEventReceiver)GetCurrentMarker(),
|
||||
NetworkEventTarget.Owner,
|
||||
"Activated", true);
|
||||
GetCurrentMarker().SendCustomNetworkEvent(NetworkEventTarget.Owner, "Activated", true);
|
||||
|
||||
UpdateInterface();
|
||||
|
||||
@@ -133,7 +127,7 @@ public class GameManagerRound3 : GameManagerBase
|
||||
|
||||
private void StartTimer()
|
||||
{
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
|
||||
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All,
|
||||
"PlayMusicLoop", MusicEventType.CarmenChaseMusic);
|
||||
|
||||
_GameStatus = GameStatus.Begin;
|
||||
@@ -148,8 +142,7 @@ public class GameManagerRound3 : GameManagerBase
|
||||
_Timer--;
|
||||
if (_Timer < 0)
|
||||
{
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.Owner,
|
||||
nameof(GameHasBeenLost), false);
|
||||
SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(GameHasBeenLost), false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -160,19 +153,10 @@ public class GameManagerRound3 : GameManagerBase
|
||||
|
||||
public void CorrectResponse()
|
||||
{
|
||||
PlayCorrectSound();
|
||||
|
||||
NetworkCalling.SendCustomNetworkEvent(
|
||||
(IUdonEventReceiver)GetCurrentMarker(),
|
||||
NetworkEventTarget.Owner,
|
||||
"Activated", false);
|
||||
|
||||
_FailureCounter = 0;
|
||||
_SuccessCounter++;
|
||||
if (_SuccessCounter >= MAX_SUCCESS_COUNT)
|
||||
{
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.Owner,
|
||||
nameof(GameHasBeenWon));
|
||||
SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(GameHasBeenWon));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -184,19 +168,7 @@ public class GameManagerRound3 : GameManagerBase
|
||||
|
||||
public void IncorrectResponse()
|
||||
{
|
||||
_FailureCounter++;
|
||||
if (_FailureCounter >= MAX_FAILURE_COUNT)
|
||||
{
|
||||
_FailureCounter = 0;
|
||||
NetworkCalling.SendCustomNetworkEvent(
|
||||
(IUdonEventReceiver)GetCurrentMarker(),
|
||||
NetworkEventTarget.Owner,
|
||||
"Activated", false);
|
||||
|
||||
SetUpNextCountry();
|
||||
}
|
||||
|
||||
PlayIncorrectSound();
|
||||
SetUpNextCountry();
|
||||
}
|
||||
|
||||
|
||||
@@ -226,14 +198,10 @@ public class GameManagerRound3 : GameManagerBase
|
||||
if (NextCountry < 0)
|
||||
{
|
||||
// If we ran out of countries, lose the game here.
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)this, NetworkEventTarget.Owner,
|
||||
nameof(GameHasBeenLost), true);
|
||||
SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(GameHasBeenLost), true);
|
||||
return;
|
||||
}
|
||||
NetworkCalling.SendCustomNetworkEvent(
|
||||
(IUdonEventReceiver)GetCurrentMarker(),
|
||||
NetworkEventTarget.Owner,
|
||||
"Activated", true);
|
||||
GetCurrentMarker().SendCustomNetworkEvent(NetworkEventTarget.Owner, "Activated", true);
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
@@ -248,7 +216,7 @@ public class GameManagerRound3 : GameManagerBase
|
||||
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
|
||||
GameWinInterface.HeaderUI.text = "The player has won the game. " + _Timer + " seconds to spare.";
|
||||
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
|
||||
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All,
|
||||
"PlaySFXLoop", SFXEventType.CarmenInJail);
|
||||
|
||||
SendCustomEventDelayedSeconds(nameof(StopFinalRoundMusic), 1.0f);
|
||||
@@ -258,11 +226,11 @@ public class GameManagerRound3 : GameManagerBase
|
||||
}
|
||||
public void StopFinalRoundMusic()
|
||||
{
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All, "StopMusic");
|
||||
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "StopMusic");
|
||||
}
|
||||
public void PlayWindDownMusic()
|
||||
{
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
|
||||
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All,
|
||||
"PlayMusicLoop", MusicEventType.CarmenSandiegoWindDown);
|
||||
|
||||
EnableInteraction("Do It, Rockapella!");
|
||||
@@ -270,7 +238,7 @@ public class GameManagerRound3 : GameManagerBase
|
||||
}
|
||||
public void EndCarmenInJailSFX()
|
||||
{
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All, "StopSFX");
|
||||
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "StopSFX");
|
||||
}
|
||||
|
||||
[NetworkCallable]
|
||||
@@ -280,10 +248,7 @@ public class GameManagerRound3 : GameManagerBase
|
||||
{
|
||||
for (int i = 0; i < _Markers.Length; i++)
|
||||
{
|
||||
NetworkCalling.SendCustomNetworkEvent(
|
||||
(IUdonEventReceiver)_Markers[i],
|
||||
NetworkEventTarget.Owner,
|
||||
"Activated", false);
|
||||
_Markers[i].SendCustomNetworkEvent(NetworkEventTarget.Owner, "Activated", false);
|
||||
}
|
||||
|
||||
GameStatusUpdate(RanOutOfMarkers ? GameStatus.RanOutOfMarkers : GameStatus.RanOutOfTime);
|
||||
@@ -304,7 +269,7 @@ public class GameManagerRound3 : GameManagerBase
|
||||
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
|
||||
Interface.HeaderUI.text = "Rockin' it acapella";
|
||||
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
|
||||
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All,
|
||||
"PlayMusicLoop", MusicEventType.CarmenSandiegoTheme);
|
||||
|
||||
EnableInteraction("End Game");
|
||||
@@ -317,7 +282,7 @@ public class GameManagerRound3 : GameManagerBase
|
||||
(HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments);
|
||||
Interface.HeaderUI.text = "Game is over. Load a new case file to start again.";
|
||||
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All, "StopMusic");
|
||||
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "StopMusic");
|
||||
|
||||
EnableInteraction("Game is over. Load a new case file to start again.");
|
||||
}
|
||||
@@ -336,13 +301,13 @@ public class GameManagerRound3 : GameManagerBase
|
||||
|
||||
public void PlayCorrectSound()
|
||||
{
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
|
||||
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All,
|
||||
"PlaySFX", SFXEventType.MapCorrect);
|
||||
}
|
||||
|
||||
public void PlayIncorrectSound()
|
||||
{
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
|
||||
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All,
|
||||
"PlaySFX", SFXEventType.MapIncorrect);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user