- Floor map markers now activate properly even if being held at round start.
- Floor map markers now react to round end much more consistently and reliably.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user