|
@@ -4,6 +4,7 @@ using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.Specialized;
|
|
|
using System.Drawing;
|
|
|
+using System.Linq;
|
|
|
using System.Net;
|
|
|
using TMPro;
|
|
|
using Unity.VisualScripting;
|
|
@@ -18,6 +19,8 @@ public class CalibrationMarkerBehavior : MonoBehaviour
|
|
|
PersonManager PersonManager => personManagerLazy.Value;
|
|
|
Lazy<PersonManager> personManagerLazy;
|
|
|
|
|
|
+ public event EventHandler PathFinished;
|
|
|
+
|
|
|
private void Awake()
|
|
|
{
|
|
|
personManagerLazy = new Lazy<PersonManager>(FindObjectOfType<PersonManager>);
|
|
@@ -38,8 +41,21 @@ public class CalibrationMarkerBehavior : MonoBehaviour
|
|
|
new Vector3(frustumCorners[3].x, 0, frustumCorners[3].y),
|
|
|
};
|
|
|
|
|
|
+ int count = 1;
|
|
|
+ const int increment = 2;
|
|
|
+ while (count < 4)
|
|
|
+ {
|
|
|
+ targetPositions.Add(new Vector3(frustumCorners[0].x + count * increment, 0, frustumCorners[0].y + (count - 1) * increment));
|
|
|
+ targetPositions.Add(new Vector3(frustumCorners[1].x + count * increment, 0, frustumCorners[1].y - count * increment));
|
|
|
+ targetPositions.Add(new Vector3(frustumCorners[2].x - count * increment, 0, frustumCorners[2].y - count * increment));
|
|
|
+ targetPositions.Add(new Vector3(frustumCorners[3].x - count * increment, 0, frustumCorners[3].y + count * increment));
|
|
|
+ count += 1;
|
|
|
+ }
|
|
|
+
|
|
|
currentTarget = GameObject.Find("CalibrationMarker").transform.position;
|
|
|
|
|
|
+ targetPositions.Add(currentTarget);
|
|
|
+
|
|
|
enabled = false;
|
|
|
PersonManager.DetectionReady += PersonManager_DetectionReady;
|
|
|
}
|
|
@@ -70,6 +86,10 @@ public class CalibrationMarkerBehavior : MonoBehaviour
|
|
|
currentTarget = targetPositions[targetIndex];
|
|
|
normalizedTranslationVector = (currentTarget - marker.transform.position).normalized;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PathFinished?.Invoke(this, EventArgs.Empty);
|
|
|
+ }
|
|
|
|
|
|
UnityEngine.Color color = UnityEngine.Color.Lerp(UnityEngine.Color.green, UnityEngine.Color.red, Time.deltaTime / 0.2f);
|
|
|
Debug.Log(string.Format("<color=#{0:X2}{1:X2}{2:X2}>{3}</color>", (byte)(color.r * 255f), (byte)(color.g * 255f), (byte)(color.b * 255f), $"deltaTime: {Time.deltaTime}"));
|