diff --git a/Assets/Prefabs/Maps/Floor Map Marker.prefab b/Assets/Prefabs/Maps/Floor Map Marker.prefab index 1cd4f3d..da39bb7 100644 --- a/Assets/Prefabs/Maps/Floor Map Marker.prefab +++ b/Assets/Prefabs/Maps/Floor Map Marker.prefab @@ -461,6 +461,7 @@ MonoBehaviour: currentlyHeldBy: {fileID: 0} pickupable: 0 proximity: 0.5 + version: 1 --- !u!114 &7701985575892871572 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/witwics.unity b/Assets/Scenes/witwics.unity index dd5107c..5737d8b 100644 --- a/Assets/Scenes/witwics.unity +++ b/Assets/Scenes/witwics.unity @@ -15565,9 +15565,14 @@ PrefabInstance: type: 3} - target: {fileID: 1856344074827895174, guid: aecb18996fccac6488cfcd38604796da, type: 3} - propertyPath: pickupable + propertyPath: version value: 1 objectReference: {fileID: 0} + - target: {fileID: 1856344074827895174, guid: aecb18996fccac6488cfcd38604796da, + type: 3} + propertyPath: AutoHold + value: 2 + objectReference: {fileID: 0} - target: {fileID: 2083024587461002224, guid: aecb18996fccac6488cfcd38604796da, type: 3} propertyPath: serializationData.Prefab @@ -15857,12 +15862,12 @@ PrefabInstance: - target: {fileID: 7701985575892871572, guid: aecb18996fccac6488cfcd38604796da, type: 3} propertyPath: lastPickupable - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 7701985575892871572, guid: aecb18996fccac6488cfcd38604796da, type: 3} propertyPath: pickupableFlag - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 7701985575892871572, guid: aecb18996fccac6488cfcd38604796da, type: 3} @@ -93293,19 +93298,19 @@ MonoBehaviour: useAssignedLayers: 0 DynamicPrefabs: [] DynamicMaterials: - - {fileID: 2100000, guid: 0c3dfdcd7a2a6ac408ec3d431f9a4932, type: 2} - - {fileID: 2100000, guid: bc5888e576e9cb34bab7b7af42d2b63f, type: 2} - - {fileID: 2100000, guid: 1eb2f964062497347b887d2c940e79c5, type: 2} - - {fileID: 2100000, guid: accd304c49b7d6d43b97738e8e118342, type: 2} - - {fileID: 2100000, guid: 2c0cd617d97924748a9d5e2eeb2039b5, type: 2} + - {fileID: 2100000, guid: d1244b908a4cccd4397cc9cad45fe846, type: 2} + - {fileID: 2100000, guid: e53b90b5a4f1c3048b28024a40b455e7, type: 2} + - {fileID: 2100000, guid: 12e96dbe16f21704485645506bfc235a, type: 2} + - {fileID: 2100000, guid: 77cb94791cc41a5498279122022730b0, type: 2} - {fileID: 2100000, guid: 4fb0b8cdca56f5d47be970c7490cb7a1, type: 2} - - {fileID: 2100000, guid: 9cdc0250a4c9b534fae68ae6aa90bf31, type: 2} - - {fileID: 2100000, guid: c1b531b2f1a7dab43b46daa7546cfda7, type: 2} - - {fileID: 2100000, guid: 348ff3cc54305654d9eeebbbb385c262, type: 2} - {fileID: 2100000, guid: af0c1cbaaffed304ba0e3a1fbac41e7e, type: 2} - {fileID: 2100000, guid: cc22c7f9de95cab4488b30fe8699a82a, type: 2} - {fileID: 2100000, guid: fe872fb72ad98da4dbb868481468e848, type: 2} - {fileID: 2100000, guid: 82f2961c9baa48a45ac897be257fd655, type: 2} + - {fileID: 2100000, guid: 9cdc0250a4c9b534fae68ae6aa90bf31, type: 2} + - {fileID: 2100000, guid: dba163de40c568b48ae2ffa7c83c66b9, type: 2} + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 2100000, guid: 0c3dfdcd7a2a6ac408ec3d431f9a4932, type: 2} - {fileID: 2100000, guid: 4de84333504452948874f4422dec7b56, type: 2} - {fileID: 2100000, guid: 97a375a2664a65f44a74b8e0711591fb, type: 2} - {fileID: 2100000, guid: 71fff76911e92ab43a71d15602da4c4b, type: 2} @@ -93313,17 +93318,15 @@ MonoBehaviour: - {fileID: 2100000, guid: ea08301eace4f164bb3aae930413a978, type: 2} - {fileID: 2100000, guid: 6dd6b8b1c8133f04dbc23ac81f5dfded, type: 2} - {fileID: 2100000, guid: c3186340e03d26341969d34663dbf8f3, type: 2} - - {fileID: 2100000, guid: d1244b908a4cccd4397cc9cad45fe846, type: 2} - - {fileID: 2100000, guid: e53b90b5a4f1c3048b28024a40b455e7, type: 2} + - {fileID: 2100000, guid: db9b2b735115eb248a189b1fdc721a50, type: 2} + - {fileID: 2100000, guid: c1b531b2f1a7dab43b46daa7546cfda7, type: 2} - {fileID: 2100000, guid: 012e77fb6a6d69548802da3b41814618, type: 2} - {fileID: 2100000, guid: 4d875a76d6e247742b8d3d66214b2c2d, type: 2} - - {fileID: 2100000, guid: 12e96dbe16f21704485645506bfc235a, type: 2} - {fileID: 2100000, guid: 8db36ece14c543d47be04e1d0cde1a1f, type: 2} - {fileID: 2100000, guid: 77485a45419b5da498cc74acff31c49a, type: 2} - {fileID: 2100000, guid: d2b3854a83244764192826cd7eadc955, type: 2} - {fileID: 2100000, guid: 8de5e47a4e3831b40b59595ad3e2e267, type: 2} - {fileID: 2100000, guid: d23dd47c26278f94ea3bc15c730f59ed, type: 2} - - {fileID: 2100000, guid: 77cb94791cc41a5498279122022730b0, type: 2} - {fileID: 2100000, guid: 98b5c6e030fc83d48bbba9e927a456d4, type: 2} - {fileID: 2100000, guid: c0998459c7ac0e94d825035839d01ac9, type: 2} - {fileID: 2100000, guid: fa8f228d6d5f77d479bf970e355f4bc3, type: 2} @@ -93336,19 +93339,21 @@ MonoBehaviour: - {fileID: 2100000, guid: c5d2a6b0c3904c747b937dd142cbb480, type: 2} - {fileID: 2100000, guid: 53b84df3db050264db8132d12d59ac74, type: 2} - {fileID: 2100000, guid: 9d4baac78c2042b47b42fc9c92d87767, type: 2} - - {fileID: 2100000, guid: db9b2b735115eb248a189b1fdc721a50, type: 2} - {fileID: 2100000, guid: cc8e36941dd3f2c42a157650e05b9242, type: 2} + - {fileID: 2100000, guid: accd304c49b7d6d43b97738e8e118342, type: 2} + - {fileID: 2100000, guid: 2c0cd617d97924748a9d5e2eeb2039b5, type: 2} - {fileID: 2100000, guid: a94d8fe1854504e47a64e023cecaa130, type: 2} - {fileID: 2100000, guid: 51b03d257a738e6468f623865f31dbec, type: 2} - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 2100000, guid: 348ff3cc54305654d9eeebbbb385c262, type: 2} - {fileID: 2100000, guid: 672c36f6dbb36b5439cc0fdd2f74c531, type: 2} - - {fileID: 2100000, guid: 35c2a316ece610b4b963e047e5238337, type: 2} - - {fileID: 2100000, guid: 332daba92d0976f4d86bdcdc1a94179e, type: 2} - - {fileID: 2100000, guid: dba163de40c568b48ae2ffa7c83c66b9, type: 2} - {fileID: 2100000, guid: e45d02bbf7268504ca58513c548a58e7, type: 2} - - {fileID: 2100000, guid: cac39def7281c5c488b6a3465ec1951b, type: 2} - - {fileID: 2100000, guid: 80746b095abb6ce41a1c737df3649172, type: 2} + - {fileID: 2100000, guid: bc5888e576e9cb34bab7b7af42d2b63f, type: 2} - {fileID: 2100000, guid: 885429151ec5f6a4a926f6aaabd7e001, type: 2} + - {fileID: 2100000, guid: 332daba92d0976f4d86bdcdc1a94179e, type: 2} + - {fileID: 2100000, guid: 1eb2f964062497347b887d2c940e79c5, type: 2} + - {fileID: 2100000, guid: 80746b095abb6ce41a1c737df3649172, type: 2} + - {fileID: 2100000, guid: 35c2a316ece610b4b963e047e5238337, type: 2} + - {fileID: 2100000, guid: cac39def7281c5c488b6a3465ec1951b, type: 2} - {fileID: 2100000, guid: 483ceb65615010745bde1d5ff9fd9dd6, type: 2} - {fileID: 2100000, guid: c10453b4aa0c864458b74f3797cb611e, type: 2} LightMapsNear: [] diff --git a/Assets/UdonSharp/Game Managers/GameManagerRound3.cs b/Assets/UdonSharp/Game Managers/GameManagerRound3.cs index 81fd981..b43737c 100644 --- a/Assets/UdonSharp/Game Managers/GameManagerRound3.cs +++ b/Assets/UdonSharp/Game Managers/GameManagerRound3.cs @@ -61,6 +61,8 @@ public class GameManagerRound3 : GameManagerBase { base.InitialiseGameMode(); + _GameStatus = GameStatus.Pregame; + _StageIndex = 0; SuccessCounter = 0; @@ -106,7 +108,7 @@ public class GameManagerRound3 : GameManagerBase _Markers[i].SendCustomNetworkEvent(NetworkEventTarget.All, "Initialise"); } - _ActiveMarker = 0; + ActiveMarker = 0; GetCurrentMarker().SendCustomNetworkEvent(NetworkEventTarget.All, "SetPickupable", true); } @@ -209,33 +211,41 @@ public class GameManagerRound3 : GameManagerBase [NetworkCallable] public void CorrectResponse() { - PlayCorrectSound(); - - SuccessCounter++; - if (SuccessCounter >= MAX_SUCCESS_COUNT) + if (_GameStatus == GameStatus.Begin) { - GameHasBeenWon(); - } - else - { - SetUpNextCountry(); - } + FloorMapMarker CurrentMarker = GetCurrentMarker(); + CurrentMarker.SendCustomNetworkEvent(NetworkEventTarget.Owner, "SetLit", true); + PlayCorrectSound(); - RequestSerialization(); + SuccessCounter++; + if (SuccessCounter >= MAX_SUCCESS_COUNT) + { + GameHasBeenWon(); + } + else + { + SetUpNextCountry(); + } + + RequestSerialization(); + } } [NetworkCallable] public void IncorrectResponse() { - PlayIncorrectSound(); - - FailureCounter++; - if (FailureCounter >= MAX_FAILURE_COUNT) + if (_GameStatus == GameStatus.Begin) { - SetUpNextCountry(); - } + PlayIncorrectSound(); - RequestSerialization(); + FailureCounter++; + if (FailureCounter >= MAX_FAILURE_COUNT) + { + SetUpNextCountry(); + } + + RequestSerialization(); + } } @@ -276,15 +286,18 @@ public class GameManagerRound3 : GameManagerBase private void ActivateMarker() { - if (ActiveMarker >= FloorMap.MAX_SELECTED_COUNTRIES) + if (_GameStatus == GameStatus.Begin) { - // If we ran out of countries, lose the game here. - SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(GameHasBeenLost), true); - return; - } + if (ActiveMarker >= FloorMap.MAX_SELECTED_COUNTRIES) + { + // If we ran out of countries, lose the game here. + SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(GameHasBeenLost), true); + return; + } - UpdateInterface(); - GetCurrentMarker().SendCustomNetworkEvent(NetworkEventTarget.Owner, "Activated", true); + UpdateInterface(); + GetCurrentMarker().SendCustomNetworkEvent(NetworkEventTarget.Owner, "Activated", true); + } } [NetworkCallable] @@ -292,13 +305,14 @@ public class GameManagerRound3 : GameManagerBase { _RunTimer = false; - if ((int)_GameStatus <= (int)GameStatus.Begin) + if (_GameStatus == GameStatus.Begin) { GameStatusUpdate(GameStatus.Win); HostCardBetweenRoundsInterface GameWinInterface = (HostCardBetweenRoundsInterface)GetHostCardInterface(RoundSegmentType.BetweenSegments); - GameWinInterface.HeaderUI.text = "The player has won the game."; + + GameWinInterface.HeaderUI.text = GetRound3PlayerName() + " has won the game."; GameWinInterface.CommentUI.text = "- " + _Timer + " seconds to spare.\n" + "- There's one more thing I want you to do for us. You know what it is..."; @@ -323,14 +337,8 @@ public class GameManagerRound3 : GameManagerBase public void EndCarmenInJailSFX() { _AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "StopSFX"); - string[] CurrentWinner = _CaseManager.GetCurrentWinningPlayers(); - if (CurrentWinner == null || CurrentWinner.Length != 1) - { - CurrentWinner = new string[1]; - CurrentWinner[0] = Networking.GetOwner(gameObject).displayName; - } - _CaptureCarmenNewspaper.SendCustomNetworkEvent(NetworkEventTarget.All, "PlayWinAnimation", CurrentWinner[0]); + _CaptureCarmenNewspaper.SendCustomNetworkEvent(NetworkEventTarget.All, "PlayWinAnimation", GetRound3PlayerName()); } [NetworkCallable] @@ -338,7 +346,7 @@ public class GameManagerRound3 : GameManagerBase { _RunTimer = false; - if (_GameStatus != GameStatus.Win) + if (_GameStatus == GameStatus.Begin) { GameStatusUpdate(RanOutOfMarkers ? GameStatus.RanOutOfMarkers : GameStatus.RanOutOfTime); @@ -445,6 +453,16 @@ public class GameManagerRound3 : GameManagerBase CaptureCarmenInterface.CommentUI.text = City + ", " + Region + Country; } + private string GetRound3PlayerName() + { + string[] CurrentWinner = _CaseManager.GetCurrentWinningPlayers(); + if (CurrentWinner == null || CurrentWinner.Length != 1) + { + return "The player"; + } + return CurrentWinner[0]; + } + protected override HostCardInterfaceBase GetHostCardInterface(RoundSegmentType Question) { diff --git a/Assets/UdonSharp/Maps/FloorMapMarker.cs b/Assets/UdonSharp/Maps/FloorMapMarker.cs index 5b2ffd5..2d3a1ac 100644 --- a/Assets/UdonSharp/Maps/FloorMapMarker.cs +++ b/Assets/UdonSharp/Maps/FloorMapMarker.cs @@ -150,11 +150,6 @@ public class FloorMapMarker : UdonSharpBehaviour public void CheckCollisionsLoop() { - if (Active) - { - SendCustomEventDelayedSeconds(nameof(CheckCollisionsLoop), TIME_BETWEEN_REPEAT_COLLISION_CHECKS); - } - if (_EnableCollisionChecks && !IsGrabbed) { if (_CollidingLocations.Count > 0 && IsUpright()) @@ -190,6 +185,11 @@ public class FloorMapMarker : UdonSharpBehaviour } } } + + if (Active) + { + SendCustomEventDelayedSeconds(nameof(CheckCollisionsLoop), TIME_BETWEEN_REPEAT_COLLISION_CHECKS); + } } @@ -208,7 +208,6 @@ public class FloorMapMarker : UdonSharpBehaviour { DisableMovementCompletely(CorrectLocation); - IsLit = true; Active = false; _EnableCollisionChecks = false; _UsedUp = true; @@ -242,15 +241,22 @@ public class FloorMapMarker : UdonSharpBehaviour public void Activated(bool SetActive) { Active = SetActive; - RequestSerialization(); } private void ReactToActivation() { _PickupComponent.pickupable = Active; + if (IsGrabbed) _EnableCollisionChecks = true; SendCustomEventDelayedSeconds(nameof(CheckCollisionsLoop), TIME_BETWEEN_REPEAT_COLLISION_CHECKS); } + [NetworkCallable] + public void SetLit(bool Lit) + { + IsLit = Lit; + RequestSerialization(); + } + public bool IsUsedUp() { @@ -283,6 +289,7 @@ public class FloorMapMarker : UdonSharpBehaviour { _Active = value; ReactToActivation(); + RequestSerialization(); } get => _Active; }