internal void OnUpdate() { if (!reportedXRStateSwitch) { reportedXRStateSwitch = true; OnXRChange?.Invoke(xrState, viewsCount, leftRect, rightRect); } if (!updatedControllersOnEnd) { updatedControllersOnEnd = true; UpdateControllersOnEnd(); } if (visibilityStateChanged) { visibilityStateChanged = false; OnVisibilityChange?.Invoke(visibilityState); } if (this.xrState == WebXRState.NORMAL) { return; } UpdateXRCameras(); bool hasHandsData = false; if (OnHandUpdate != null && this.xrState != WebXRState.NORMAL) { if (GetHandFromHandsArray(0, ref leftHand)) { OnHandUpdate?.Invoke(leftHand); } if (GetHandFromHandsArray(1, ref rightHand)) { OnHandUpdate?.Invoke(rightHand); } hasHandsData = leftHand.enabled || rightHand.enabled; } if (!hasHandsData && OnControllerUpdate != null && this.xrState != WebXRState.NORMAL) { if (GetGamepadFromControllersArray(0, ref controller1)) { OnControllerUpdate?.Invoke(controller1); } if (GetGamepadFromControllersArray(1, ref controller2)) { OnControllerUpdate?.Invoke(controller2); } } if (OnViewerHitTestUpdate != null && this.xrState == WebXRState.AR) { if (GetHitTestPoseFromViewerHitTestPoseArray(ref viewerHitTestPose)) { OnViewerHitTestUpdate?.Invoke(viewerHitTestPose); } } }
public void ShowDialogue() { visible = true; OnVisibilityChange?.Invoke(visible); Panel.SetActive(visible); }
public void HideDialogue() { visible = false; OnVisibilityChange?.Invoke(visible); Panel.SetActive(visible); }
public void SetVisibility(float target, bool instant = false) { if (float.IsNaN(target)) target = 0; target = Mathf.Clamp(target, 0, 1); if (target == TargetVisibility) return; IsVisible = target > 0; TargetVisibility = target; Transitioning = true; if (instant) { FinishReveal(); } OnVisibilityChange?.Invoke(Element, IsVisible); }
internal void AddVisibilityListener(OnVisibilityChange listener) { visibilityListeners.Add(listener); }
internal void AddVisibilityListener(FieldInfo field, OnVisibilityChange listener) { GetFieldVisibility(field).AddVisibilityListener(listener); }