private FrustumMarker CreateMarker(FrustumTrackedObject obj) { var marker = Instantiate(frustumMarker, transform, false); markers.Add(obj, marker); marker.SetMarkerData(obj.data); return(marker); }
private void RemoveMarker(FrustumTrackedObject obj) { FrustumMarker marker = null; if (markers.TryGetValue(obj, out marker)) { Destroy(marker.gameObject); markers.Remove(obj); } }
private void ShowMarker(FrustumTrackedObject obj) { FrustumMarker marker; if (markers.TryGetValue(obj, out marker) == false) { marker = CreateMarker(obj); } marker.gameObject.SetActive(true); }
/// <summary> /// Handle for tracked objects events /// </summary> /// <param name="obj"></param> /// <param name="isVisible"></param> void OnObjectVisibilityChanged(FrustumTrackedObject obj, bool isVisible) { //Debug.Log(obj.name + " is now " + (isVisible ? "visible" : "unvisible")); if (isVisible) { RemoveMarker(obj); } else { ShowMarker(obj); } }
private void TestTrackedObject(FrustumTrackedObject obj) { // TODO: find a wayt to hide this public method for a tracked object obj.SetVisibility(outOfFrustum.TestVisisbility(obj.Bounds)); }