Added a rudimentary system for handling ties between contestants.
This commit is contained in:
parent
9c8d8e35cf
commit
cf240aeda7
@ -158,7 +158,7 @@ public class GameManager : UdonSharpBehaviour
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_CurrentQuestion = _QuestionsList[0].DataDictionary;
|
_CurrentQuestion = _QuestionsList[_QuestionIndex].DataDictionary;
|
||||||
|
|
||||||
_BetweenRoundsInterface.HeaderUI.text =
|
_BetweenRoundsInterface.HeaderUI.text =
|
||||||
"Found " + _QuestionsList.Count + " questions in this case file. Press 'Use' button to show scores.";
|
"Found " + _QuestionsList.Count + " questions in this case file. Press 'Use' button to show scores.";
|
||||||
@ -648,6 +648,55 @@ public class GameManager : UdonSharpBehaviour
|
|||||||
EnableInteraction("Reveal Next Player Answer");
|
EnableInteraction("Reveal Next Player Answer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FinalRoundDetermineWinners()
|
||||||
|
{
|
||||||
|
SortPlayersHighToLowScore();
|
||||||
|
|
||||||
|
int[] SortedPlayerScores = new int[_PlayerPodiums.Length];
|
||||||
|
for (int i = 0; i < _PlayerPodiums.Length; i++)
|
||||||
|
{
|
||||||
|
SortedPlayerScores[i] = _PlayerPodiums[_FinalRoundPlayersSortedByScore[i] - 1].PlayerScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TiebreakerNeeded = false;
|
||||||
|
if (SortedPlayerScores[1] == SortedPlayerScores[2])
|
||||||
|
{
|
||||||
|
if (SortedPlayerScores[0] == SortedPlayerScores[1])
|
||||||
|
{
|
||||||
|
Debug.LogError("Three-way tie");
|
||||||
|
TiebreakerNeeded = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning("Tie for second place");
|
||||||
|
TiebreakerNeeded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VRCPlayerApi Number1 = Networking.GetOwner(_PlayerPodiums[_FinalRoundPlayersSortedByScore[0] - 1].gameObject);
|
||||||
|
VRCPlayerApi Number2 = Networking.GetOwner(_PlayerPodiums[_FinalRoundPlayersSortedByScore[1] - 1].gameObject);
|
||||||
|
|
||||||
|
if (SortedPlayerScores[0] == SortedPlayerScores[1])
|
||||||
|
{
|
||||||
|
// Tag both players as being tied for first place
|
||||||
|
Number1.SetPlayerTag("Round1State", "TiedForFirstPlace");
|
||||||
|
Number2.SetPlayerTag("Round2State", "TiedForFirstPlace");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Tag first place player as first place, and second place as second
|
||||||
|
Number1.SetPlayerTag("Round1State", "FirstPlace");
|
||||||
|
Number2.SetPlayerTag("Round2State", "SecondPlace");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TiebreakerNeeded)
|
||||||
|
{
|
||||||
|
EnableInteraction("Advance to tiebreaker");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void AdvanceToNextQuestion()
|
private void AdvanceToNextQuestion()
|
||||||
{
|
{
|
||||||
@ -886,7 +935,8 @@ public class GameManager : UdonSharpBehaviour
|
|||||||
case 10: FinalRoundAssignPointsToPlayerPlace(2); break;
|
case 10: FinalRoundAssignPointsToPlayerPlace(2); break;
|
||||||
case 11: FinalRoundRevealPlayerPlace(1); break;
|
case 11: FinalRoundRevealPlayerPlace(1); break;
|
||||||
case 12: FinalRoundAssignPointsToPlayerPlace(1); break;
|
case 12: FinalRoundAssignPointsToPlayerPlace(1); break;
|
||||||
case 13: AdvanceToNextQuestion(); break;
|
case 13: FinalRoundDetermineWinners(); break;
|
||||||
|
case 14: AdvanceToNextQuestion(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
||||||
m_Name: BoneFollower
|
m_Name: BoneFollower
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
serializedUdonProgramAsset: {fileID: 11400000, guid: ccbda9bf23e2f714c9226283c77a92e5,
|
serializedUdonProgramAsset: {fileID: 11400000, guid: 52ecc8a73071e8e40928c3609699fcf4,
|
||||||
type: 2}
|
type: 2}
|
||||||
udonAssembly:
|
udonAssembly:
|
||||||
assemblyError:
|
assemblyError:
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
||||||
m_Name: InteractToggle
|
m_Name: InteractToggle
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
serializedUdonProgramAsset: {fileID: 11400000, guid: 405e38d3dfb2f514daeed0e28fbb4864,
|
serializedUdonProgramAsset: {fileID: 11400000, guid: 873dfce61b1514e429c92e0d2fded7de,
|
||||||
type: 2}
|
type: 2}
|
||||||
udonAssembly:
|
udonAssembly:
|
||||||
assemblyError:
|
assemblyError:
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
||||||
m_Name: PlayerModSetter
|
m_Name: PlayerModSetter
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
serializedUdonProgramAsset: {fileID: 11400000, guid: f938e6c4ff027a74da405a1f9353fd2b,
|
serializedUdonProgramAsset: {fileID: 11400000, guid: e81558796a212ab4d88e305e2010f24b,
|
||||||
type: 2}
|
type: 2}
|
||||||
udonAssembly:
|
udonAssembly:
|
||||||
assemblyError:
|
assemblyError:
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
||||||
m_Name: GlobalToggleObject
|
m_Name: GlobalToggleObject
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
serializedUdonProgramAsset: {fileID: 11400000, guid: c49c9265a3ef24642a6a4465d0a78872,
|
serializedUdonProgramAsset: {fileID: 11400000, guid: 2fe8ced6184000f49bca526cd2c5891c,
|
||||||
type: 2}
|
type: 2}
|
||||||
udonAssembly:
|
udonAssembly:
|
||||||
assemblyError:
|
assemblyError:
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
||||||
m_Name: MasterToggleObject
|
m_Name: MasterToggleObject
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
serializedUdonProgramAsset: {fileID: 11400000, guid: 04024a76ab1924042ba521e11cb76d91,
|
serializedUdonProgramAsset: {fileID: 11400000, guid: a2d01d9f36ac6df49831be249e48ecc4,
|
||||||
type: 2}
|
type: 2}
|
||||||
udonAssembly:
|
udonAssembly:
|
||||||
assemblyError:
|
assemblyError:
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
||||||
m_Name: TrackingDataFollower
|
m_Name: TrackingDataFollower
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
serializedUdonProgramAsset: {fileID: 11400000, guid: 17f8fbbe6cc186d4f8dbb057b01a4ec2,
|
serializedUdonProgramAsset: {fileID: 11400000, guid: 1b89d4552983c0448a7389decec3b555,
|
||||||
type: 2}
|
type: 2}
|
||||||
udonAssembly:
|
udonAssembly:
|
||||||
assemblyError:
|
assemblyError:
|
||||||
|
|||||||
@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
|
||||||
m_Name: WorldAudioSettings
|
m_Name: WorldAudioSettings
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
serializedUdonProgramAsset: {fileID: 11400000, guid: 128d924a3066b7546b2d1c73e61006ab,
|
serializedUdonProgramAsset: {fileID: 11400000, guid: 994b559b0f158b4499f8937980ed8694,
|
||||||
type: 2}
|
type: 2}
|
||||||
udonAssembly:
|
udonAssembly:
|
||||||
assemblyError:
|
assemblyError:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user