71 lines
2.9 KiB
C#
71 lines
2.9 KiB
C#
|
|
using XCEngine;
|
||
|
|
|
||
|
|
namespace Gameplay
|
||
|
|
{
|
||
|
|
public sealed class ComponentFieldMetadataProbe : MonoBehaviour
|
||
|
|
{
|
||
|
|
public Transform Pivot;
|
||
|
|
public Camera SceneCamera;
|
||
|
|
public ScriptComponentTargetProbe ScriptTarget;
|
||
|
|
public Component UnsupportedComponent;
|
||
|
|
public Behaviour UnsupportedBehaviour;
|
||
|
|
public MonoBehaviour UnsupportedMonoBehaviour;
|
||
|
|
}
|
||
|
|
|
||
|
|
public sealed class ComponentFieldProbe : MonoBehaviour
|
||
|
|
{
|
||
|
|
public Transform Pivot;
|
||
|
|
public Camera SceneCamera;
|
||
|
|
public ScriptComponentTargetProbe ScriptTarget;
|
||
|
|
|
||
|
|
public bool ObservedStoredPivotApplied;
|
||
|
|
public bool ObservedStoredCameraApplied;
|
||
|
|
public bool ObservedStoredScriptApplied;
|
||
|
|
public string ObservedPivotName = string.Empty;
|
||
|
|
public string ObservedCameraName = string.Empty;
|
||
|
|
public string ObservedScriptName = string.Empty;
|
||
|
|
public int ObservedScriptAwakeCount = -1;
|
||
|
|
public int ObservedScriptHostCallCount = -1;
|
||
|
|
|
||
|
|
public bool ObservedUpdatedPivotAssigned;
|
||
|
|
public bool ObservedUpdatedCameraAssigned;
|
||
|
|
public bool ObservedUpdatedScriptAssigned;
|
||
|
|
public string ObservedUpdatedPivotName = string.Empty;
|
||
|
|
public string ObservedUpdatedCameraName = string.Empty;
|
||
|
|
public string ObservedUpdatedScriptName = string.Empty;
|
||
|
|
|
||
|
|
public void Start()
|
||
|
|
{
|
||
|
|
ObservedStoredPivotApplied = Pivot != null;
|
||
|
|
ObservedStoredCameraApplied = SceneCamera != null;
|
||
|
|
ObservedStoredScriptApplied = ScriptTarget != null;
|
||
|
|
|
||
|
|
ObservedPivotName = Pivot != null ? Pivot.gameObject.name : string.Empty;
|
||
|
|
ObservedCameraName = SceneCamera != null ? SceneCamera.gameObject.name : string.Empty;
|
||
|
|
ObservedScriptName = ScriptTarget != null ? ScriptTarget.gameObject.name : string.Empty;
|
||
|
|
|
||
|
|
if (ScriptTarget != null)
|
||
|
|
{
|
||
|
|
ObservedScriptAwakeCount = ScriptTarget.AwakeCount;
|
||
|
|
ScriptTarget.IncrementFromHost();
|
||
|
|
ObservedScriptHostCallCount = ScriptTarget.HostCallCount;
|
||
|
|
}
|
||
|
|
|
||
|
|
Pivot = transform;
|
||
|
|
SceneCamera = GetComponent<Camera>();
|
||
|
|
ScriptTarget = GetComponent<ScriptComponentTargetProbe>();
|
||
|
|
if (ScriptTarget == null)
|
||
|
|
{
|
||
|
|
ScriptTarget = AddComponent<ScriptComponentTargetProbe>();
|
||
|
|
}
|
||
|
|
|
||
|
|
ObservedUpdatedPivotAssigned = Pivot != null;
|
||
|
|
ObservedUpdatedCameraAssigned = SceneCamera != null;
|
||
|
|
ObservedUpdatedScriptAssigned = ScriptTarget != null;
|
||
|
|
ObservedUpdatedPivotName = Pivot != null ? Pivot.gameObject.name : string.Empty;
|
||
|
|
ObservedUpdatedCameraName = SceneCamera != null ? SceneCamera.gameObject.name : string.Empty;
|
||
|
|
ObservedUpdatedScriptName = ScriptTarget != null ? ScriptTarget.gameObject.name : string.Empty;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|