feat: add core quiz game logic, scoreboard, team machine, player management, and debug view with supporting assets and scene.
This commit is contained in:
@@ -10,6 +10,7 @@ public class PlayerManager : UdonSharpBehaviour
|
||||
[UdonSynced] private int[] playerScores = new int[0];
|
||||
[UdonSynced] private string[] playerTeams = new string[0];
|
||||
[UdonSynced] public int[] currentPlayerIds = new int[0];
|
||||
public ScoreboardManager scoreboardManager;
|
||||
|
||||
public override void OnPlayerJoined(VRCPlayerApi player)
|
||||
{
|
||||
@@ -43,6 +44,7 @@ public class PlayerManager : UdonSharpBehaviour
|
||||
newCurrentIds[currentPlayerIds.Length] = id;
|
||||
currentPlayerIds = newCurrentIds;
|
||||
|
||||
UpdateScoreboards();
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
@@ -63,6 +65,7 @@ public class PlayerManager : UdonSharpBehaviour
|
||||
}
|
||||
currentPlayerIds = newCurrentIds;
|
||||
|
||||
UpdateScoreboards();
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
@@ -78,6 +81,7 @@ public class PlayerManager : UdonSharpBehaviour
|
||||
break;
|
||||
}
|
||||
}
|
||||
UpdateScoreboards();
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
@@ -105,6 +109,7 @@ public class PlayerManager : UdonSharpBehaviour
|
||||
break;
|
||||
}
|
||||
}
|
||||
UpdateScoreboards();
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
@@ -129,6 +134,7 @@ public class PlayerManager : UdonSharpBehaviour
|
||||
if (index >= 0)
|
||||
{
|
||||
playerTeams[index] = team;
|
||||
UpdateScoreboards();
|
||||
RequestSerialization();
|
||||
}
|
||||
}
|
||||
@@ -168,4 +174,17 @@ public class PlayerManager : UdonSharpBehaviour
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public override void OnDeserialization()
|
||||
{
|
||||
UpdateScoreboards();
|
||||
}
|
||||
|
||||
private void UpdateScoreboards()
|
||||
{
|
||||
if (scoreboardManager != null)
|
||||
{
|
||||
scoreboardManager.UpdateAllScoreboards();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user