- Keeping logs of previous round winners so player names can be referenced.
- Round 3 sync seems to work now, but resets and early grabs cause issues.
This commit is contained in:
@@ -212,6 +212,11 @@ public class CaseManager : UdonSharpBehaviour
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
public string[] GetCurrentWinningPlayers()
|
||||
{
|
||||
return _CurrentWinningPlayers;
|
||||
}
|
||||
|
||||
|
||||
public string CrookToString(AccusedCrook Crook)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 8
|
||||
Data: 9
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
@@ -519,6 +519,60 @@ MonoBehaviour:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _Players
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 33|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _Players
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 23
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 23
|
||||
- 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: 34|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 1
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data: 35|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:
|
||||
|
||||
@@ -3,8 +3,8 @@ using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDK3.Data;
|
||||
using VRC.SDK3.UdonNetworkCalling;
|
||||
using VRC.Udon.Common.Interfaces;
|
||||
using VRC.SDKBase;
|
||||
using VRC.Udon.Common.Interfaces;
|
||||
|
||||
|
||||
public enum PanelType
|
||||
@@ -28,6 +28,7 @@ public class GameManagerRound2 : GameManagerBase
|
||||
|
||||
[UdonSynced] private int _StageIndex = 0;
|
||||
[UdonSynced] private int _CurrentPlayerCounter = 0;
|
||||
[UdonSynced] private string[] _Players = new string[2];
|
||||
|
||||
|
||||
public override void InitialiseGameMode()
|
||||
@@ -111,8 +112,17 @@ public class GameManagerRound2 : GameManagerBase
|
||||
|
||||
private void BeginRound()
|
||||
{
|
||||
_Players = _CaseManager.GetCurrentWinningPlayers();
|
||||
if (_Players == null || _Players.Length != 2)
|
||||
{
|
||||
_Players = new string[2];
|
||||
_Players[0] = Networking.GetOwner(gameObject).displayName;
|
||||
_Players[1] = _Players[0];
|
||||
}
|
||||
|
||||
HostCardRecoverTheLootInterface RecoverTheLootInterface =
|
||||
(HostCardRecoverTheLootInterface)GetHostCardInterface(RoundSegmentType.RecoverTheLoot);
|
||||
RecoverTheLootInterface.SetComment(_Players[_CurrentPlayerCounter % _Players.Length] + ", you're up first.", Color.black);
|
||||
|
||||
for (int i = 0; i < _Landmarks.Length; i++)
|
||||
{
|
||||
@@ -193,16 +203,20 @@ public class GameManagerRound2 : GameManagerBase
|
||||
// and should also enable victory animations.
|
||||
public void YoureWinner()
|
||||
{
|
||||
string[] Winner = new string[1];
|
||||
Winner[0] = _Players[_CurrentPlayerCounter % _Players.Length];
|
||||
_CaseManager.SetCurrentWinningPlayers(Winner);
|
||||
|
||||
HostCardRecoverTheLootInterface Interface =
|
||||
(HostCardRecoverTheLootInterface)GetHostCardInterface(RoundSegmentType.RecoverTheLoot);
|
||||
Interface.SetComment("Winner! Congratulations, [[PLAYER]]", Color.red);
|
||||
Interface.SetComment("Winner! Congratulations, " + Winner[0], Color.red);
|
||||
|
||||
Interface.EnableAllPanelButtons(false);
|
||||
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
|
||||
"StopMusic");
|
||||
|
||||
EnableInteraction("Continue with the game in whatever way ends up being necessary when this is implemented");
|
||||
EnableInteraction("Go To The Map");
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +243,7 @@ public class GameManagerRound2 : GameManagerBase
|
||||
|
||||
Interface.EnableAllPanelButtons(true);
|
||||
|
||||
Interface.SetComment("[[PLAYER]], your turn.", Color.black);
|
||||
Interface.SetComment(_Players[_CurrentPlayerCounter % _Players.Length] + ", your turn.", Color.black);
|
||||
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 15
|
||||
Data: 16
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
@@ -536,25 +536,25 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _CollisionCheckCounter
|
||||
Data: _CheckingCollisions
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CollisionCheckCounter
|
||||
Data: _CheckingCollisions
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 32
|
||||
Data: 15
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 32
|
||||
Data: 15
|
||||
- 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:
|
||||
@@ -566,7 +566,13 @@ MonoBehaviour:
|
||||
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:
|
||||
@@ -584,13 +590,13 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _NoCollisionCounter
|
||||
Data: _CollisionCheckCounter
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _NoCollisionCounter
|
||||
Data: _CollisionCheckCounter
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 32
|
||||
@@ -611,7 +617,7 @@ MonoBehaviour:
|
||||
Data: false
|
||||
- Name: _fieldAttributes
|
||||
Entry: 7
|
||||
Data: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
Data: 39|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
|
||||
- Name:
|
||||
Entry: 12
|
||||
Data: 0
|
||||
@@ -632,25 +638,19 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _CollidingLocations
|
||||
Data: _NoCollisionCounter
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 39|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
Data: 40|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _CollidingLocations
|
||||
Data: _NoCollisionCounter
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 40|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: VRC.SDK3.Data.DataList, VRCSDK3
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
Entry: 9
|
||||
Data: 32
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 40
|
||||
Data: 32
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -686,19 +686,19 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _RigidBodyComponent
|
||||
Data: _CollidingLocations
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 42|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _RigidBodyComponent
|
||||
Data: _CollidingLocations
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 43|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: UnityEngine.Rigidbody, UnityEngine.PhysicsModule
|
||||
Data: VRC.SDK3.Data.DataList, VRCSDK3
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -740,25 +740,25 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _ObjectSync
|
||||
Data: _RigidBodyComponent
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _ObjectSync
|
||||
Data: _RigidBodyComponent
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 46|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: MMMaellon.LightSync.LightSync, com.mmmaellon.lightsync
|
||||
Data: UnityEngine.Rigidbody, UnityEngine.PhysicsModule
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 4
|
||||
Data: 46
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -794,25 +794,25 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _PickupComponent
|
||||
Data: _ObjectSync
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _PickupComponent
|
||||
Data: _ObjectSync
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 49|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: VRC.SDK3.Components.VRCPickup, VRCSDK3
|
||||
Data: MMMaellon.LightSync.LightSync, com.mmmaellon.lightsync
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 49
|
||||
Data: 4
|
||||
- Name: <SyncMode>k__BackingField
|
||||
Entry: 7
|
||||
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
|
||||
@@ -848,19 +848,19 @@ MonoBehaviour:
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _MarkerMesh
|
||||
Data: _PickupComponent
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 51|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _MarkerMesh
|
||||
Data: _PickupComponent
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 52|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: UnityEngine.MeshRenderer, UnityEngine.CoreModule
|
||||
Data: VRC.SDK3.Components.VRCPickup, VRCSDK3
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
@@ -897,6 +897,60 @@ MonoBehaviour:
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name:
|
||||
Entry: 7
|
||||
Data:
|
||||
- Name: $k
|
||||
Entry: 1
|
||||
Data: _MarkerMesh
|
||||
- Name: $v
|
||||
Entry: 7
|
||||
Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
|
||||
- Name: <Name>k__BackingField
|
||||
Entry: 1
|
||||
Data: _MarkerMesh
|
||||
- Name: <UserType>k__BackingField
|
||||
Entry: 7
|
||||
Data: 55|System.RuntimeType, mscorlib
|
||||
- Name:
|
||||
Entry: 1
|
||||
Data: UnityEngine.MeshRenderer, UnityEngine.CoreModule
|
||||
- Name:
|
||||
Entry: 8
|
||||
Data:
|
||||
- Name: <SystemType>k__BackingField
|
||||
Entry: 9
|
||||
Data: 55
|
||||
- Name: <SyncMode>k__BackingField
|
||||
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: 56|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: 13
|
||||
Data:
|
||||
|
||||
@@ -23,6 +23,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
[UdonSynced] private bool _LocationFindingEnabled = false;
|
||||
|
||||
[UdonSynced] private int _FailureCounter = 0;
|
||||
[UdonSynced] private bool _CheckingCollisions = false;
|
||||
private int _CollisionCheckCounter = 0;
|
||||
private int _NoCollisionCounter = 0;
|
||||
private DataList _CollidingLocations = new DataList();
|
||||
@@ -34,7 +35,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
|
||||
private const int MAX_FAILURE_COUNT = 2;
|
||||
private const int MAX_REPEAT_COLLISION_CHECKS = 3;
|
||||
private const int MAX_TIME_WITH_NO_COLLISIONS = 8;
|
||||
private const int MAX_CHECKS_WITH_NO_COLLISIONS = 8;
|
||||
private const float TIME_BETWEEN_REPEAT_COLLISION_CHECKS = 0.15f;
|
||||
|
||||
|
||||
@@ -55,7 +56,9 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
IsGrabbed = false;
|
||||
IsLit = false;
|
||||
_LocationFindingEnabled = false;
|
||||
_CheckingCollisions = false;
|
||||
|
||||
_FailureCounter = 0;
|
||||
_CollisionCheckCounter = 0;
|
||||
_NoCollisionCounter = 0;
|
||||
_CollidingLocations.Clear();
|
||||
@@ -75,9 +78,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
if (Location != null)
|
||||
{
|
||||
_CollidingLocations.Add(Location);
|
||||
_CollisionCheckCounter = 0;
|
||||
_NoCollisionCounter = 0;
|
||||
if (!IsGrabbed) CheckCollisions();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +88,6 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
if (Location != null)
|
||||
{
|
||||
_CollidingLocations.Remove(Location);
|
||||
_CollisionCheckCounter = 0;
|
||||
_NoCollisionCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,17 +138,20 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
}
|
||||
|
||||
_NoCollisionCounter = 0;
|
||||
CheckCollisions();
|
||||
if (!_CheckingCollisions) SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(CheckCollisions));
|
||||
}
|
||||
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
|
||||
[NetworkCallable]
|
||||
public void CheckCollisions()
|
||||
{
|
||||
if (!Active || !_LocationFindingEnabled || IsGrabbed) return;
|
||||
|
||||
_CheckingCollisions = true;
|
||||
|
||||
if (_CollidingLocations.Count > 0 && IsUpright())
|
||||
{
|
||||
_NoCollisionCounter = 0;
|
||||
@@ -162,8 +164,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
bool FoundCorrectResponse = ConfirmChoice(Location.Country, Location.City);
|
||||
if (FoundCorrectResponse)
|
||||
{
|
||||
SendCustomNetworkEvent(NetworkEventTarget.Owner,
|
||||
nameof(SendCorrectResponse), Location.transform.position);
|
||||
SendCorrectResponse(Location.transform.position);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -177,16 +178,16 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(SendIncorrectResponse));
|
||||
SendIncorrectResponse();
|
||||
}
|
||||
_CollisionCheckCounter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_NoCollisionCounter++;
|
||||
if (_NoCollisionCounter >= MAX_TIME_WITH_NO_COLLISIONS)
|
||||
if (_NoCollisionCounter >= MAX_CHECKS_WITH_NO_COLLISIONS)
|
||||
{
|
||||
SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(SendIncorrectResponse));
|
||||
SendIncorrectResponse();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -209,33 +210,33 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
return false;
|
||||
}
|
||||
|
||||
[NetworkCallable]
|
||||
public void SendCorrectResponse(Vector3 CorrectLocation)
|
||||
private void SendCorrectResponse(Vector3 CorrectLocation)
|
||||
{
|
||||
DisableMovementCompletely(CorrectLocation);
|
||||
|
||||
IsLit = true;
|
||||
Active = false;
|
||||
_CheckingCollisions = false;
|
||||
|
||||
RequestSerialization();
|
||||
|
||||
_GameManager.SendCustomNetworkEvent(NetworkEventTarget.Owner, "CorrectResponse");
|
||||
_GameManager.PlayCorrectSound();
|
||||
_GameManager.CorrectResponse();
|
||||
}
|
||||
|
||||
[NetworkCallable]
|
||||
public void SendIncorrectResponse()
|
||||
private void SendIncorrectResponse()
|
||||
{
|
||||
DisableMovementCompletely();
|
||||
|
||||
_CollisionCheckCounter = 0;
|
||||
_CheckingCollisions = false;
|
||||
_CollidingLocations.Clear();
|
||||
|
||||
_FailureCounter++;
|
||||
if (_FailureCounter >= MAX_FAILURE_COUNT)
|
||||
{
|
||||
Active = false;
|
||||
_GameManager.IncorrectResponse();
|
||||
_GameManager.SendCustomNetworkEvent(NetworkEventTarget.Owner, "IncorrectResponse");
|
||||
}
|
||||
|
||||
_GameManager.PlayIncorrectSound();
|
||||
@@ -243,6 +244,7 @@ public class FloorMapMarker : UdonSharpBehaviour
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
[NetworkCallable]
|
||||
public void Activated(bool SetActive)
|
||||
{
|
||||
Active = SetActive;
|
||||
|
||||
Reference in New Issue
Block a user