void Update() { if (_startTime > Time.time) { return; } if (_originalScale == null) { _originalScale = transform.localScale; } if (!CheckHideWhenMoving()) { return; } if (CameraMovementTracker.Instance.Distance > DistanceMoveTrigger || CameraMovementTracker.Instance.RotationDelta > DeltaRotationTrigger || _isJustEnabled) { _isJustEnabled = false; MoveIntoView(); } #if UNITY_EDITOR if (_showDebugBoxcastLines) { LookingDirectionHelpers.GetObjectBeforeObstruction(gameObject, MaxDistance, DistanceBeforeObstruction, LayerMask, _stabilizer, true); } #endif }
private Vector3 GetNewPosition() { var newPos = LookingDirectionHelpers.GetObjectBeforeObstruction(gameObject, MaxDistance, DistanceBeforeObstruction, LayerMask, _stabilizer); return(newPos); }
void Update() { if (Time.time > _lastPollTime) { _lastPollTime = Time.time + PollInterval; LeanTween.move(gameObject, GetNewPosition(), 0.5f).setEaseInOutSine(); } #if UNITY_EDITOR if (_showDebugBoxcastLines) { LookingDirectionHelpers.GetObjectBeforeObstruction(gameObject, MaxDistance, DistanceBeforeObstruction, LayerMask, _stabilizer, true); } #endif }