- Added more camera switches to the end of round 3. - Made round 3 camera animations reset more reliably. - Added more decorations, including self-updating Wanted and Missing posters. - Added a crook portrait for Carmen Sandiego as part of the above. - Uncommented seemingly useless code in CaseVideoSyncPlayer; not so useless. - RandomVideoPlayer now sets ownership properly on ownership transfer. - Location board crook portraits no longer use a shared material. - Lowered resolution of crook portraits. - Paper materials now have their normal map on the detail UVs instead. - Drew more of Robocrook's lower half, and filled out his portrait more.
70 lines
1.7 KiB
C#
70 lines
1.7 KiB
C#
|
|
using TMPro;
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDKBase;
|
|
using VRC.Udon;
|
|
using VRC.Udon.Common;
|
|
|
|
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
|
public class WantedPoster : UdonSharpBehaviour
|
|
{
|
|
[SerializeField] private TextMeshProUGUI _CrookName;
|
|
[SerializeField] private TextMeshProUGUI _RewardText;
|
|
[Space]
|
|
[SerializeField] private MeshRenderer _WantedPosterMesh;
|
|
[SerializeField] private Texture _DefaultPortrait;
|
|
[SerializeField] private Texture[] _CrookPortraits;
|
|
[SerializeField] private string _DefaultReward;
|
|
[SerializeField] private string[] _RewardOptions;
|
|
|
|
[UdonSynced] private int _SelectedCrook = (int)AccusedCrook.INDEX_MAX;
|
|
[UdonSynced] private string _Name = "";
|
|
[UdonSynced] private int _RewardIndex = 0;
|
|
|
|
private Material _PortraitMaterial = null;
|
|
|
|
|
|
private void Start()
|
|
{
|
|
_PortraitMaterial = _WantedPosterMesh.materials[2];
|
|
}
|
|
|
|
void OnDestroy()
|
|
{
|
|
SetNewCrook(AccusedCrook.INDEX_MAX, "Carmen Sandiego");
|
|
}
|
|
|
|
public override void OnDeserialization(DeserializationResult Result)
|
|
{
|
|
_ApplyNewConfiguration();
|
|
base.OnDeserialization(Result);
|
|
}
|
|
|
|
|
|
public void SetNewCrook(AccusedCrook Crook, string Name)
|
|
{
|
|
_SelectedCrook = (int)Crook;
|
|
_Name = Name;
|
|
_RewardIndex = Random.Range(0, _RewardOptions.Length);
|
|
_ApplyNewConfiguration();
|
|
RequestSerialization();
|
|
}
|
|
|
|
private void _ApplyNewConfiguration()
|
|
{
|
|
if (_SelectedCrook == (int)AccusedCrook.INDEX_MAX)
|
|
{
|
|
_PortraitMaterial.SetTexture("_MainTex", _DefaultPortrait);
|
|
_RewardText.text = "Reward: " + _DefaultReward;
|
|
}
|
|
else
|
|
{
|
|
_PortraitMaterial.SetTexture("_MainTex", _CrookPortraits[_SelectedCrook]);
|
|
_RewardText.text = "Reward: " + _RewardOptions[_RewardIndex];
|
|
}
|
|
_CrookName.text = _Name;
|
|
}
|
|
}
|