- Enhanced camera bubble. - Added placeholder player podiums. - Added Crunch compression to more textures.
75 lines
1.3 KiB
C#
75 lines
1.3 KiB
C#
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDKBase;
|
|
using VRC.Udon;
|
|
using TMPro;
|
|
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
|
public class PlayerPodium : UdonSharpBehaviour
|
|
{
|
|
public int PlayerNumber = 0;
|
|
|
|
[UdonSynced] private bool NameplateLocked = false;
|
|
[UdonSynced, FieldChangeCallback(nameof(PlayerName))] private string _PlayerName = "Player";
|
|
[UdonSynced, FieldChangeCallback(nameof(PlayerScore))] private int _PlayerScore = 50;
|
|
|
|
public TextMeshProUGUI Nameplate;
|
|
public TextMeshProUGUI Scorecard;
|
|
|
|
void Start()
|
|
{
|
|
_PlayerName = "Player " + PlayerNumber;
|
|
}
|
|
|
|
|
|
public void SetPlayerName()
|
|
{
|
|
if (NameplateLocked) { return; }
|
|
Networking.SetOwner(Networking.LocalPlayer, gameObject);
|
|
PlayerName = Networking.LocalPlayer.displayName;
|
|
NameplateLocked = true;
|
|
|
|
RequestSerialization();
|
|
}
|
|
|
|
public void DecreaseScoreBy5()
|
|
{
|
|
PlayerScore -= 5;
|
|
RequestSerialization();
|
|
}
|
|
|
|
public void IncreaseScoreBy5()
|
|
{
|
|
PlayerScore += 5;
|
|
RequestSerialization();
|
|
}
|
|
|
|
public void IncreaseScoreBy10()
|
|
{
|
|
PlayerScore += 10;
|
|
RequestSerialization();
|
|
}
|
|
|
|
|
|
public string PlayerName
|
|
{
|
|
set
|
|
{
|
|
_PlayerName = value;
|
|
Nameplate.text = value;
|
|
}
|
|
get => _PlayerName;
|
|
}
|
|
|
|
public int PlayerScore
|
|
{
|
|
set
|
|
{
|
|
_PlayerScore = value;
|
|
Scorecard.text = PlayerScore.ToString();
|
|
}
|
|
get => _PlayerScore;
|
|
}
|
|
}
|