- Made the newspaper overlay a proper CameraOverlay object. - Added a purple trim to the round 1 walls. - Fixed the shape and lightmaps on the round 1 doorway stairs. - Slowed down and tweaked the opening doorway camera shot.
70 lines
1.5 KiB
C#
70 lines
1.5 KiB
C#
|
|
using TMPro;
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using UnityEngine.Device;
|
|
using UnityEngine.UI;
|
|
using VRC.Udon.Common;
|
|
|
|
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
|
public class TimerDisplay : UdonSharpBehaviour
|
|
{
|
|
[SerializeField] private GameObject _Camera;
|
|
[SerializeField] private RawImage _Timer;
|
|
[SerializeField] private Material _TimerMaterial;
|
|
[SerializeField] private int _MaxSeconds = 45;
|
|
[SerializeField] private TextMeshProUGUI _CounterText;
|
|
|
|
[UdonSynced] private bool _Active;
|
|
|
|
[UdonSynced] private int _ElapsedSeconds = 0;
|
|
[UdonSynced] private int _CorrectMarkers = 0;
|
|
|
|
|
|
public override void OnDeserialization(DeserializationResult Result)
|
|
{
|
|
_SyncedValues();
|
|
base.OnDeserialization(Result);
|
|
}
|
|
|
|
|
|
public void Initialise()
|
|
{
|
|
_ElapsedSeconds = 0;
|
|
_CorrectMarkers = 0;
|
|
_SyncedValues();
|
|
RequestSerialization();
|
|
}
|
|
|
|
public void Activate(bool Activate)
|
|
{
|
|
_Active = Activate;
|
|
_SyncedValues();
|
|
RequestSerialization();
|
|
}
|
|
|
|
public void SecondsElapsed(int ElapsedSeconds)
|
|
{
|
|
_ElapsedSeconds = ElapsedSeconds;
|
|
_SyncedValues();
|
|
RequestSerialization();
|
|
}
|
|
|
|
public void NewCorrectMarker()
|
|
{
|
|
_CorrectMarkers++;
|
|
_SyncedValues();
|
|
RequestSerialization();
|
|
}
|
|
|
|
|
|
private void _SyncedValues()
|
|
{
|
|
_Camera.SetActive(_Active);
|
|
Debug.Log("[TimerDisplay] Elapsed seconds: " + _ElapsedSeconds);
|
|
_Timer.material.SetFloat("_WiperProgress", (float)_ElapsedSeconds / (float)_MaxSeconds);
|
|
_CounterText.text = _CorrectMarkers.ToString();
|
|
}
|
|
}
|