- Added new round 1 switchers, and fixed overlap issues with the existing ones. - Improved camera switch buttons on the host panel. - Potato Mode button on the camera host panel now toggles properly. - Potato Mode button renamed to the more appropriate Performance button. - Glass shatter window effect now works from both directions. - Round 1 window looks much prettier. - Added the ability to scroll through overflowing text on the host card. - Improved scrolling on the credits panel.
91 lines
1.9 KiB
C#
91 lines
1.9 KiB
C#
|
|
using CameraSystem;
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDKBase;
|
|
using VRC.Udon;
|
|
using VRC.Udon.Common;
|
|
|
|
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
|
public class CameraControllerBase : UdonSharpBehaviour
|
|
{
|
|
[SerializeField] private CameraSystem_Console _CameraConsole;
|
|
|
|
[UdonSynced] private int _ActiveCamera = -1;
|
|
|
|
private CameraTimedSwitcher _ActiveSwitcher = null;
|
|
|
|
|
|
public override void OnDeserialization(DeserializationResult Result)
|
|
{
|
|
_SwitchToLiveCamera_Synced();
|
|
|
|
base.OnDeserialization(Result);
|
|
}
|
|
|
|
|
|
public virtual void InitialiseCameras() { }
|
|
public virtual void DeinitialiseCameras()
|
|
{
|
|
DisableAllTriggers();
|
|
DisableAllSwitchers();
|
|
}
|
|
|
|
|
|
public void SwitchToLiveCamera(Camera SwitchTo)
|
|
{
|
|
for (int i = 0; i < _CameraConsole.camerasObjects.Length; i++)
|
|
{
|
|
if (_CameraConsole.camerasObjects[i] == SwitchTo)
|
|
{
|
|
_ActiveCamera = i;
|
|
_SwitchToLiveCamera_Synced();
|
|
RequestSerialization();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ActivateCameraSwitcher(CameraTimedSwitcher Switcher = null)
|
|
{
|
|
if (_ActiveSwitcher == Switcher)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (_ActiveSwitcher != null)
|
|
{
|
|
_ActiveSwitcher.Activate = false;
|
|
}
|
|
|
|
_ActiveSwitcher = Switcher;
|
|
|
|
if (_ActiveSwitcher != null)
|
|
{
|
|
_ActiveSwitcher.Activate = true;
|
|
}
|
|
|
|
}
|
|
|
|
public virtual void DisableAllTriggers()
|
|
{
|
|
Debug.LogError("[CameraControllerBase] This function has not been reimplemented, or is called from a child class.");
|
|
}
|
|
|
|
public virtual void DisableAllSwitchers()
|
|
{
|
|
Debug.LogError("[CameraControllerBase] This function has not been reimplemented, or is called from a child class.");
|
|
}
|
|
|
|
|
|
private void _SwitchToLiveCamera_Synced()
|
|
{
|
|
if (_ActiveCamera >= 0 && _ActiveCamera < _CameraConsole.camerasObjects.Length)
|
|
{
|
|
Debug.Log("[CameraControllerBase] Switching to camera " + _ActiveCamera);
|
|
_CameraConsole.SendLiveCamera(_ActiveCamera);
|
|
}
|
|
}
|
|
}
|