protected virtual void LateUpdate() { inputManager.Update(); foreach (var finger in inputManager.Fingers) { if (finger.Down == true) { Pick(finger.Position); } } var targetAlpha = 0.0f; if (FloatingCamera != null && WorldCamera != null) { if (CurrentTarget != null) { var localPosition = FloatingCamera.CalculatePosition(ref CurrentTarget.CachedPoint.Position); var screenPoint = WorldCamera.WorldToScreenPoint(localPosition); if (screenPoint.z >= 0.0f) { var anchoredPosition = default(Vector2); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(Parent, screenPoint, null, out anchoredPosition) == true) { Rect.anchoredPosition = anchoredPosition; } targetAlpha = 1.0f; if (HideIfTooClose == true) { if (SgtPosition.SqrDistance(ref SgtFloatingCamera.Instances.First.Value.Position, ref CurrentTarget.CachedPoint.Position) <= CurrentTarget.WarpDistance * CurrentTarget.WarpDistance) { targetAlpha = 0.0f; } } } else { Alpha = 0.0f; } Title.text = CurrentTarget.WarpName; } } var factor = SgtHelper.DampenFactor(10.0f, Time.deltaTime); Alpha = Mathf.Lerp(Alpha, targetAlpha, factor); Group.alpha = Alpha; Group.blocksRaycasts = targetAlpha > 0.0f; }
protected virtual void LateUpdate() { var targetAlpha = 0.0f; if (floatingCamera != null && worldCamera != null) { if (currentTarget != null) { var localPosition = floatingCamera.CalculatePosition(currentTarget.CachedPoint.Position); var screenPoint = worldCamera.WorldToScreenPoint(localPosition); if (screenPoint.z >= 0.0f) { var anchoredPosition = default(Vector2); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(parent, screenPoint, null, out anchoredPosition) == true) { rect.anchoredPosition = anchoredPosition; } targetAlpha = 1.0f; if (hideIfTooClose == true) { if (SgtPosition.SqrDistance(SgtFloatingCamera.Instances.First.Value.Position, currentTarget.CachedPoint.Position) <= currentTarget.WarpDistance * currentTarget.WarpDistance) { targetAlpha = 0.0f; } } } else { alpha = 0.0f; } title.text = currentTarget.WarpName; } } var factor = SgtHelper.DampenFactor(10.0f, Time.deltaTime); alpha = Mathf.Lerp(alpha, targetAlpha, factor); group.alpha = alpha; group.blocksRaycasts = targetAlpha > 0.0f; }
protected virtual void LateUpdate() { var floatingCamera = default(SgtFloatingCamera); var targetAlpha = 0.0f; if (SgtFloatingCamera.TryGetCamera(1, ref floatingCamera) == true) { if (CurrentTarget != null) { var localPosition = floatingCamera.CalculatePosition(ref CurrentTarget.CachedPoint.Position); var screenPoint = floatingCamera.CachedCamera.WorldToScreenPoint(localPosition); if (screenPoint.z >= 0.0f) { var anchoredPosition = default(Vector2); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(Parent, screenPoint, null, out anchoredPosition) == true) { Rect.anchoredPosition = anchoredPosition; } targetAlpha = 1.0f; if (HideIfTooClose == true) { if (SgtPosition.SqrDistance(ref SgtFloatingOrigin.CurrentPoint.Position, ref CurrentTarget.CachedPoint.Position) <= CurrentTarget.WarpDistance * CurrentTarget.WarpDistance) { targetAlpha = 0.0f; } } } else { Alpha = 0.0f; } Title.text = CurrentTarget.WarpName; } } Alpha = SgtHelper.Dampen(Alpha, targetAlpha, 10.0f, Time.deltaTime); Group.alpha = Alpha; Group.blocksRaycasts = targetAlpha > 0.0f; }
private void HandleDistance(double distance) { var floatingCamera = SgtFloatingCamera.Instances.First.Value; var sqrDistance = SgtPosition.SqrDistance(ref CachedObject.Position, ref floatingCamera.Position); var newInside = distance <= (double)Range; if (inside != newInside) { inside = newInside; if (inside == true) { SpawnAll(); } else { DespawnAll(); } } }