protected override void LateUpdate()
{
// Base
base.LateUpdate();
// Basic checks
if ((SpatialUnderstanding.Instance == null) ||
((SpatialUnderstanding.Instance.ScanState != SpatialUnderstanding.ScanStates.Scanning) &&
(SpatialUnderstanding.Instance.ScanState != SpatialUnderstanding.ScanStates.Finishing) &&
(SpatialUnderstanding.Instance.ScanState != SpatialUnderstanding.ScanStates.Done)))
{
CursorText.gameObject.SetActive(false);
return;
}
if (!SpatialUnderstanding.Instance.AllowSpatialUnderstanding)
{
return;
}
// Report the results
if ((rayCastResult != null) &&
(rayCastResult.SurfaceType != SpatialUnderstandingDll.Imports.RaycastResult.SurfaceTypes.Invalid))
{
CursorText.gameObject.SetActive(true);
CursorText.text = rayCastResult.SurfaceType.ToString();
CursorText.transform.rotation = Quaternion.LookRotation(Camera.main.transform.forward, Vector3.up);
CursorText.transform.position = transform.position + Camera.main.transform.right * 0.05f;
}
else
{
CursorText.gameObject.SetActive(false);
}
// If we're looking at the UI, fade the text
Vector3 hitPos, hitNormal;
UnityEngine.UI.Button hitButton;
float textAlpha = RayCastUI(out hitPos, out hitNormal, out hitButton) ? 0.15f : 1.0f;
CursorText.color = new Color(1.0f, 1.0f, 1.0f, textAlpha);
}
}