public virtual async Task SetIsVisibleAsync(bool isVisible, float?fadeTime = null) { if (fadeTweener.IsRunning) { fadeTweener.Stop(); } this.isVisible = isVisible; OnVisibilityChanged.SafeInvoke(isVisible); if (!CanvasGroup) { return; } CanvasGroup.interactable = isVisible; CanvasGroup.blocksRaycasts = isVisible; var fadeDuration = fadeTime ?? FadeTime; var targetOpacity = isVisible ? 1f : 0f; if (fadeDuration == 0f) { CanvasGroup.alpha = targetOpacity; return; } var tween = new FloatTween(CanvasGroup.alpha, targetOpacity, fadeDuration, alpha => CanvasGroup.alpha = alpha); await fadeTweener.RunAsync(tween); }
public void UpdateTerrainChunk() { if (lodMeshes == null) { // meshes are cleared return; } if (!heightMapReceived) { return; } // Effecient way to check chunk distance float viewerDstFromNearestEdge = Mathf.Sqrt(bounds.SqrDistance(viewerPosition)); // To check for removal bool wasVisible = IsVisible(); bool visible = viewerDstFromNearestEdge <= maxViewDst; if (visible) { int lodIndex = 0; for (int i = 0; i < detailLevels.Length - 1; i++) { // In the last case, chunk will not be visible if (viewerDstFromNearestEdge > detailLevels[i].visibleDstThreshold) { lodIndex = i + 1; } else { break; } } if (lodIndex != prevLODIndex) { LODMesh lodMesh = lodMeshes[lodIndex]; if (lodMesh.hasMesh) { prevLODIndex = lodIndex; meshFilter.mesh = lodMesh.mesh; } else if (!lodMesh.hasRequestedMesh) { lodMesh.RequestMesh(heightMap, meshSettings); } } } if (wasVisible != visible) { SetVisible(visible); if (OnVisibilityChanged != null) { OnVisibilityChanged.Invoke(this, visible); } } }
internal protected virtual void TriggerOnVisibilityChanged(Component sender, bool state) { if (OnVisibilityChanged != null) { OnVisibilityChanged.Invoke(new BoolStateEventArgs(sender, state)); } }
public void Show() { if (IsVisible) { return; } Logger.Debug("Showing orbits"); m_hideOrbitCommands.Undo(); m_hideOrbitCommands = new CommandSet(); IsVisible = true; OnVisibilityChanged?.Invoke(true); }
public void Hide() { if (!IsVisible) { return; } Logger.Debug("Hiding orbits"); CreateHideVesselCommands(m_hideOrbitCommands); CreateHideBodiesCommands(m_hideOrbitCommands); m_hideOrbitCommands.Execute(); IsVisible = false; OnVisibilityChanged?.Invoke(false); }
public void UpdateTerrainChunk() { if (!DataMapReceived || Viewer?.ViewerType == TerrainViewer.ViewerTypes.secondary) { return; } float viewerDstFromNearestEdge = Mathf.Sqrt(Bounds.SqrDistance(ViewerPosition)); bool wasVisible = IsVisible; bool visible = viewerDstFromNearestEdge <= MaxViewDistance; if (visible) { int lodIndex = 0; for (int i = 0; i < detailLevels.Length - 1; i++) { if (viewerDstFromNearestEdge > detailLevels[i].VisibleDistanceThreshold) { lodIndex = i + 1; } else { break; } } if (lodIndex != CurrentLODIndex) { LODMesh lodMesh = lodMeshes[lodIndex]; if (lodMesh.HasMesh) { CurrentLODIndex = lodIndex; meshFilter.mesh = lodMesh.Mesh; } else if (!lodMesh.HasRequestedMesh) { lodMesh.RequestMesh(DataMap.HeightMap, MeshSettings); } } } if (wasVisible != visible) { SetVisible(visible); OnVisibilityChanged?.Invoke(this, visible); } }
public void Show() { Log.Info("OrbitVisibilityController.Show"); if (IsVisible) { return; } Log.Debug("Showing orbits"); m_hideOrbitCommands.Undo(); m_hideOrbitCommands = new CommandSet(); IsVisible = true; OnVisibilityChanged?.Invoke(true); }
internal static void SetOpen(bool open) { if (IsOpen == open) { return; } IsOpen = open; if (!open) { SaveHandlers.ForEach(handler => handler.Save()); } OnVisibilityChanged.SafeInvoke(EventArgs.Empty); }
//Public Methods: public void Update() { //set visibility: if (Hand.HandConfidence > .85f && !Visible) { Visible = true; OnVisibilityChanged?.Invoke(this, true); } else if (Hand.HandConfidence <= .85f && Visible) { Visible = false; OnVisibilityChanged?.Invoke(this, false); } Skeleton.Update(); Gesture.Update(); }
public void UpdateTerrainChunk() { if (mapReceived) { float viewerDistanceFromNearestEdge = Mathf.Sqrt(bounds.SqrDistance(ViewerPosition)); bool wasVisible = IsVisible(); bool visible = viewerDistanceFromNearestEdge <= maxViewDistance; if (visible) { int lodIndex = 0; for (int i = 0; i < detailLevels.Length - 1; i++) { if (viewerDistanceFromNearestEdge > detailLevels[i].visibleDistanceThreshold) { lodIndex = i + 1; } else { break; } } if (lodIndex != previousLODIndex) { LODMesh lodMesh = lodMeshes[lodIndex]; if (lodMesh.hasMesh) { previousLODIndex = lodIndex; meshFilter.mesh = lodMesh.mesh; } else if (!lodMesh.hasRequestedMesh) { lodMesh.RequestMesh(heightMap.values, meshSettings); } } } if (wasVisible != visible) { SetVisible(visible); OnVisibilityChanged?.Invoke(this, visible); } } }
//Constructors: public ManagedFinger(MLHand hand, params ManagedKeypoint[] points) { //sets: _hand = hand; this.points = points; _lastReliableEnd = points[0]; //hooks: foreach (var item in points) { item.OnFound += HandlePointVisibilityChanged; item.OnLost += HandlePointVisibilityChanged; } //initial events: OnVisibilityChanged?.Invoke(false); HandlePointVisibilityChanged(); }
public void UpdateTerrainChunk(bool force) { // Debug.Log($"[HeightmapReceived={_heightMapReceived}] Updating terrain chunk."); if (_heightMapReceived || force) { var viewerDstFromNearestEdge = Mathf.Sqrt(_bounds.SqrDistance(ViewerPosition)); var wasVisible = IsVisible(); var visible = viewerDstFromNearestEdge <= _maxViewDst; if (visible) { var lodIndex = 0; for (var i = 0; i < _detailLevels.Length - 1; i++) if (viewerDstFromNearestEdge > _detailLevels[i].visibleDstThreshold) lodIndex = i + 1; else break; if (lodIndex != _previousLodIndex) { var lodMesh = _lodMeshes[lodIndex]; if (lodMesh.HasMesh) { _previousLodIndex = lodIndex; _meshFilter.mesh = lodMesh.Mesh; } else if (!lodMesh.HasRequestedMesh) { lodMesh.RequestMesh(_heightMap, _meshSettings); } } } if (wasVisible != visible) { SetVisible(visible); OnVisibilityChanged?.Invoke(this, visible); } } }
public virtual void SetIsVisible(bool isVisible) { if (fadeTweener.IsRunning) { fadeTweener.Stop(); } this.isVisible = isVisible; OnVisibilityChanged.SafeInvoke(isVisible); if (!CanvasGroup) { return; } CanvasGroup.interactable = isVisible; CanvasGroup.blocksRaycasts = isVisible; CanvasGroup.alpha = isVisible ? 1f : 0f; }
public void UpdateChunk() { if (!heightMapReceived) { return; } float viewDistanceFromNearestEdge = Mathf.Sqrt(bounds.SqrDistance(viewerPosition)); bool wasVisible = IsVisible(); bool visible = viewDistanceFromNearestEdge <= maxViewDistance; if (visible) { int terrainLODIndex = 0; for (; terrainLODIndex < detailLevels.Length - 1; terrainLODIndex++) { if (detailLevels[terrainLODIndex].visibleDistanceThreshold >= viewDistanceFromNearestEdge) { break; } } if (terrainLODIndex != previousLODIndex) { LODMesh lodMesh = lodMeshes[terrainLODIndex]; if (lodMesh.hasMesh) { previousLODIndex = terrainLODIndex; meshFilter.mesh = lodMesh.mesh; } else if (!lodMesh.hasRequestedMesh) { lodMesh.RequestMesh(heightMap, meshSettings); } } } if (wasVisible != visible) { SetVisible(visible); OnVisibilityChanged?.Invoke(this, visible); } }
//Public Methods: public void Update() { //set visibility: if (Hand.HandConfidence > .85f && !Visible) { Visible = true; OnVisibilityChanged?.Invoke(this, true); } else if (Hand.HandConfidence <= .85f && Visible) { Visible = false; OnVisibilityChanged?.Invoke(this, false); } Skeleton.Update(); Gesture.Update(); Collider.Update(_handInput.palmCollisions); if (_handInput != null) { Collider.Update(_handInput.palmCollisions); } }
//Public Methods: public void Update() { //set visibility: if (Hand.HandConfidence > .85f && !Visible) { Visible = true; OnVisibilityChanged?.Invoke(this, true); } else if (Hand.HandConfidence <= .85f && Visible) { Visible = false; OnVisibilityChanged?.Invoke(this, false); } Skeleton.Update(); Gesture.Update(); // Modified here by prnvcher to not explode if using null hand input if (_handInput != null) { Collider?.Update(_handInput.palmCollisions); } }
//Public Methods: public void Update() { //set visibility: if (Hand.HandConfidence > .85f && !Visible) { Visible = true; OnVisibilityChanged?.Invoke(this, true); } else if (Visible) { IntentPose pose = Gesture.Intent; var isPinching = (pose == IntentPose.Grasping || pose == IntentPose.Pinching); float minConfidence = isPinching ? .80f : .85f; if (Hand.HandConfidence <= minConfidence) { Visible = false; OnVisibilityChanged?.Invoke(this, false); } } Skeleton.Update(); Gesture.Update(); }
public void InvokeVisibilityChangedEvent(bool value) { OnVisibilityChanged?.Invoke(value); onVisibilityChanged?.Invoke(value); }
public void FireLostEvent() { IsVisible = false; OnVisibilityChanged?.Invoke(this, false); }
//Public Methods: public void FireFoundEvent() { IsVisible = true; OnVisibilityChanged?.Invoke(this, true); }
public void UpdateTerrainChunk() { if (!_heightMapReceived) { return; } var viewerDistanceFromNearestEdge = Mathf.Sqrt(_bounds.SqrDistance(viewerPosition)); var wasVisible = IsVisible(); var visible = viewerDistanceFromNearestEdge <= _maxViewDistance; if (visible) { var lodIndex = 0; for (var i = 0; i < _detailLevels.Length - 1; i++) { if (viewerDistanceFromNearestEdge > _detailLevels[i].visibleDistanceThreshold) { lodIndex = i + 1; } else { break; } } if (lodIndex != _prevLODIndex) { var lodMesh = _lodMeshes[lodIndex]; if (lodMesh.hasMesh) { _prevLODIndex = lodIndex; _meshFilter.mesh = lodMesh.mesh; if (!_droidsRequested) { CreateInitialDroids(lodMesh.meshVertices); } if (!_meshDatSentForTower) { BuildingAndTowerSpawner.instance .AddTerrainData(lodMesh.meshVertices, _sampleCenter, _meshObject.transform, _bounds); _meshDatSentForTower = true; } } else if (!lodMesh.hasRequestedMesh) { lodMesh.RequestMesh(_heightMap, _meshSettings); } if (lodIndex == 0 && lodMesh.hasMesh) { LOD0ValidStateAvailable(lodMesh); } else if (lodIndex != 0) { _chunkTrees.ClearTrees(); } } } if (wasVisible != visible) { SetVisible(visible); OnVisibilityChanged?.Invoke(this, visible); } }
private void TriggerVisibilityChangedEvent() { OnVisibilityChanged.InvokeSafely(IsVisible, transform.position); OnVisibilityChangedEvent.Invoke(IsVisible, transform.position); }
void HideAction(string[] args) { OnVisibilityChanged?.Invoke(false); }