Example #1
0
        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
        }
Example #2
0
        private Vector3 GetNewPosition()
        {
            var newPos = LookingDirectionHelpers.GetObjectBeforeObstruction(gameObject, MaxDistance,
                                                                            DistanceBeforeObstruction, LayerMask, _stabilizer);

            return(newPos);
        }
Example #3
0
        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
        }