quantum-space-buddies/QSB/Utility/DebugCameraSettings.cs

38 lines
764 B
C#
Raw Normal View History

2021-12-30 13:55:41 +00:00
using UnityEngine;
2022-03-03 03:46:33 +00:00
namespace QSB.Utility;
2023-07-28 18:30:57 +00:00
public class DebugCameraSettings : MonoBehaviour, IAddComponentOnStart
2021-12-30 13:55:41 +00:00
{
2022-03-03 03:46:33 +00:00
public static void UpdateFromDebugSetting()
2021-12-30 13:55:41 +00:00
{
2022-03-03 03:46:33 +00:00
if (QSBCore.DebugSettings.GreySkybox)
2021-12-30 13:55:41 +00:00
{
2022-03-03 03:46:33 +00:00
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
if (Camera.main)
2021-12-30 13:55:41 +00:00
{
2022-03-03 03:46:33 +00:00
Camera.main.backgroundColor = Color.gray;
2021-12-30 13:55:41 +00:00
}
2022-03-03 03:46:33 +00:00
}
else
{
QSBSceneManager.OnSceneLoaded -= OnSceneLoaded;
if (Camera.main)
2022-01-18 23:50:20 +00:00
{
2022-03-03 03:46:33 +00:00
Camera.main.backgroundColor = _origColor;
2022-01-18 23:50:20 +00:00
}
}
2022-03-03 03:46:33 +00:00
}
2022-01-18 23:50:20 +00:00
2022-03-03 03:46:33 +00:00
private static Color _origColor;
2022-01-18 23:50:20 +00:00
2022-03-03 03:46:33 +00:00
private void Awake()
{
_origColor = Camera.main.backgroundColor;
UpdateFromDebugSetting();
Destroy(this);
}
2022-03-03 03:46:33 +00:00
private static void OnSceneLoaded(OWScene arg1, OWScene arg2, bool arg3)
=> Camera.main.backgroundColor = Color.gray;
}