// Token: 0x060021CA RID: 8650 RVA: 0x0009F93C File Offset: 0x0009DB3C private void DoUpdate() { if (!this.targetRenderer) { UnityEngine.Object.Destroy(base.gameObject); return; } switch (this.highlightState) { case HighlightRect.HighlightState.Expanding: this.time += Time.deltaTime; if (this.time >= this.expandTime) { this.time = this.expandTime; this.highlightState = HighlightRect.HighlightState.Holding; } break; case HighlightRect.HighlightState.Holding: if (this.destroyOnLifeEnd) { this.time += Time.deltaTime; if (this.time > this.maxLifeTime) { this.highlightState = HighlightRect.HighlightState.Contracting; this.time = this.expandTime; } } break; case HighlightRect.HighlightState.Contracting: this.time -= Time.deltaTime; if (this.time <= 0f) { UnityEngine.Object.Destroy(base.gameObject); return; } break; } Rect rect = HighlightRect.GUIRectWithObject(this.sceneCam, this.targetRenderer); Vector2 a = new Vector2(Mathf.Lerp(rect.xMin, rect.xMax, 0.5f), Mathf.Lerp(rect.yMin, rect.yMax, 0.5f)); float t = this.curve.Evaluate(this.time / this.expandTime); this.bottomLeftRectTransform.anchoredPosition = Vector2.LerpUnclamped(a, new Vector2(rect.xMin, rect.yMin), t); this.bottomRightRectTransform.anchoredPosition = Vector2.LerpUnclamped(a, new Vector2(rect.xMax, rect.yMin), t); this.topLeftRectTransform.anchoredPosition = Vector2.LerpUnclamped(a, new Vector2(rect.xMin, rect.yMax), t); this.topRightRectTransform.anchoredPosition = Vector2.LerpUnclamped(a, new Vector2(rect.xMax, rect.yMax), t); if (this.nametagRectTransform) { this.nametagRectTransform.anchoredPosition = Vector2.LerpUnclamped(a, new Vector2(rect.xMin, rect.yMax), t); } }
// Token: 0x060021CB RID: 8651 RVA: 0x0009FB48 File Offset: 0x0009DD48 public static Rect GUIRectWithObject(Camera cam, Renderer rend) { Vector3 center = rend.bounds.center; Vector3 extents = rend.bounds.extents; HighlightRect.extentPoints[0] = HighlightRect.WorldToGUIPoint(cam, new Vector3(center.x - extents.x, center.y - extents.y, center.z - extents.z)); HighlightRect.extentPoints[1] = HighlightRect.WorldToGUIPoint(cam, new Vector3(center.x + extents.x, center.y - extents.y, center.z - extents.z)); HighlightRect.extentPoints[2] = HighlightRect.WorldToGUIPoint(cam, new Vector3(center.x - extents.x, center.y - extents.y, center.z + extents.z)); HighlightRect.extentPoints[3] = HighlightRect.WorldToGUIPoint(cam, new Vector3(center.x + extents.x, center.y - extents.y, center.z + extents.z)); HighlightRect.extentPoints[4] = HighlightRect.WorldToGUIPoint(cam, new Vector3(center.x - extents.x, center.y + extents.y, center.z - extents.z)); HighlightRect.extentPoints[5] = HighlightRect.WorldToGUIPoint(cam, new Vector3(center.x + extents.x, center.y + extents.y, center.z - extents.z)); HighlightRect.extentPoints[6] = HighlightRect.WorldToGUIPoint(cam, new Vector3(center.x - extents.x, center.y + extents.y, center.z + extents.z)); HighlightRect.extentPoints[7] = HighlightRect.WorldToGUIPoint(cam, new Vector3(center.x + extents.x, center.y + extents.y, center.z + extents.z)); Vector2 vector = HighlightRect.extentPoints[0]; Vector2 vector2 = HighlightRect.extentPoints[0]; foreach (Vector2 rhs in HighlightRect.extentPoints) { vector = Vector2.Min(vector, rhs); vector2 = Vector2.Max(vector2, rhs); } return(new Rect(vector.x, vector.y, vector2.x - vector.x, vector2.y - vector.y)); }
// Token: 0x060021CD RID: 8653 RVA: 0x0009FDE8 File Offset: 0x0009DFE8 public static void CreateHighlight(GameObject viewerBodyObject, Renderer targetRenderer, GameObject highlightPrefab, float overrideDuration = -1f, bool visibleToAll = false) { ReadOnlyCollection <CameraRigController> readOnlyInstancesList = CameraRigController.readOnlyInstancesList; int i = 0; int count = readOnlyInstancesList.Count; while (i < count) { CameraRigController cameraRigController = readOnlyInstancesList[i]; if (!(cameraRigController.target != viewerBodyObject) || visibleToAll) { HighlightRect component = UnityEngine.Object.Instantiate <GameObject>(highlightPrefab).GetComponent <HighlightRect>(); component.targetRenderer = targetRenderer; component.canvas.worldCamera = cameraRigController.uiCam; component.uiCam = cameraRigController.uiCam; component.sceneCam = cameraRigController.sceneCam; if (overrideDuration > 0f) { component.maxLifeTime = overrideDuration; } } i++; } }