remove quantum debug shapes

This commit is contained in:
_nebula 2023-11-14 12:14:52 +00:00
parent 2baf3d41c7
commit 7309b67af8
4 changed files with 1 additions and 87 deletions

Binary file not shown.

View File

@ -54,7 +54,6 @@ public class QSBCore : ModBehaviour
public static string DefaultServerIP;
public static AssetBundle NetworkAssetBundle { get; private set; }
public static AssetBundle ConversationAssetBundle { get; private set; }
public static AssetBundle DebugAssetBundle { get; private set; }
public static AssetBundle HUDAssetBundle { get; private set; }
public static bool IsHost => NetworkServer.active;
public static bool IsInMultiplayer;
@ -264,10 +263,9 @@ public class QSBCore : ModBehaviour
NetworkAssetBundle = LoadBundle("qsb_network");
ConversationAssetBundle = LoadBundle("qsb_conversation");
DebugAssetBundle = LoadBundle("qsb_debug");
HUDAssetBundle = LoadBundle("qsb_hud");
if (NetworkAssetBundle == null || ConversationAssetBundle == null || DebugAssetBundle == null || HUDAssetBundle == null)
if (NetworkAssetBundle == null || ConversationAssetBundle == null || HUDAssetBundle == null)
{
DebugLog.ToConsole($"FATAL - An assetbundle is missing! Re-install mod or contact devs.", MessageType.Fatal);
return;
@ -426,7 +424,6 @@ public class QSBCore : ModBehaviour
GetComponent<DebugActions>().enabled = DebugSettings.DebugMode;
GetComponent<DebugGUI>().enabled = DebugSettings.DebugMode;
QuantumManager.UpdateFromDebugSetting();
DebugCameraSettings.UpdateFromDebugSetting();
DebugLog.ToConsole($"DEBUG MODE = {DebugSettings.DebugMode}");

View File

@ -36,8 +36,6 @@ public class QuantumManager : WorldObjectManager
{
Shrine = QSBWorldSync.GetUnityObject<QuantumShrine>();
}
UpdateFromDebugSetting();
}
public void PlayerLeave(PlayerInfo player)
@ -147,81 +145,4 @@ public class QuantumManager : WorldObjectManager
}
}
}
#region debug shapes
private static GameObject _debugSphere, _debugCube, _debugCapsule;
private class DebugShape : MonoBehaviour { }
public static void UpdateFromDebugSetting()
{
if (QSBCore.DebugSettings.DrawQuantumVisibilityObjects)
{
if (_debugSphere == null)
{
_debugSphere = QSBCore.DebugAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/Sphere.prefab");
}
if (_debugCube == null)
{
_debugCube = QSBCore.DebugAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/Cube.prefab");
}
if (_debugCapsule == null)
{
_debugCapsule = QSBCore.DebugAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/Capsule.prefab");
}
foreach (var quantumObject in QSBWorldSync.GetWorldObjects<IQSBQuantumObject>())
{
foreach (var shape in quantumObject.GetAttachedShapes())
{
if (shape is BoxShape boxShape)
{
var newCube = Instantiate(_debugCube);
newCube.transform.parent = shape.transform;
newCube.transform.localPosition = Vector3.zero;
newCube.transform.localRotation = Quaternion.Euler(0, 0, 0);
newCube.transform.localScale = boxShape.size;
newCube.AddComponent<DebugShape>();
}
else if (shape is SphereShape sphereShape)
{
var newSphere = Instantiate(_debugSphere);
newSphere.transform.parent = shape.transform;
newSphere.transform.localPosition = Vector3.zero;
newSphere.transform.localRotation = Quaternion.Euler(0, 0, 0);
newSphere.transform.localScale = Vector3.one * (sphereShape.radius * 2);
newSphere.AddComponent<DebugShape>();
}
else if (shape is CapsuleShape capsuleShape)
{
var newCapsule = Instantiate(_debugCapsule);
newCapsule.transform.parent = shape.transform;
newCapsule.transform.localPosition = Vector3.zero;
newCapsule.transform.localRotation = Quaternion.Euler(0, 0, 0);
newCapsule.transform.localScale = new Vector3(capsuleShape.radius * 2, capsuleShape.height, capsuleShape.radius * 2);
newCapsule.AddComponent<DebugShape>();
}
}
}
}
else
{
foreach (var quantumObject in QSBWorldSync.GetWorldObjects<IQSBQuantumObject>())
{
foreach (var shape in quantumObject.GetAttachedShapes())
{
var debugShape = shape.GetComponentInChildren<DebugShape>();
if (debugShape)
{
Destroy(debugShape.gameObject);
}
}
}
}
}
#endregion
}

View File

@ -47,10 +47,6 @@ public class DebugSettings
private bool _drawLabels;
public bool DrawLabels => DebugMode && _drawLabels;
[JsonProperty("drawQuantumVisibilityObjects")]
private bool _drawQuantumVisibilityObjects;
public bool DrawQuantumVisibilityObjects => DebugMode && _drawQuantumVisibilityObjects;
[JsonProperty("drawGhostAI")]
private bool _drawGhostAI;
public bool DrawGhostAI => DebugMode && _drawGhostAI;