Ejemplo n.º 1
0
 private void Update()
 {
     if (FollowTarget != null)
     {
         transform.position = Mathfx.Damp(transform.position, FollowTarget.position + WorldOffset, 0.5f, Time.deltaTime * InterpolateSpeed);
     }
 }
    private void Update()
    {
        float invDeltaTime = 1.0f / Mathf.Max(0.001f, Time.deltaTime);

        // Update move direction
        Vector3 clampedMoveDir = Vector3.ClampMagnitude(MoveVector, 1);

        _currentMoveDir = Mathfx.Damp(_currentMoveDir, clampedMoveDir, 0.25f, Time.deltaTime * Acceleration);

        // Move to new position on nav mesh
        Vector3 newPosition = transform.position + _currentMoveDir * Time.deltaTime * MoveSpeed * MoveSpeedMultiplier;
        Vector3 navPosition;

        if (PathFindManager.Instance.TryGetTraversablePoint(newPosition, out navPosition))
        {
            Vector3 delta = navPosition - transform.position;
            _currentVelocity   = Mathfx.Damp(_currentVelocity, delta * invDeltaTime, 0.25f, Time.deltaTime * 3);
            transform.position = navPosition;
        }

        // Rotate and tilt to face direction
        if (_currentMoveDir.sqrMagnitude > 0.01f)
        {
            Vector3    runTiltAxis = Vector3.Cross(_currentMoveDir, Vector3.up);
            Quaternion forwardRot  = Quaternion.LookRotation(_currentMoveDir);
            Quaternion runTiltRot  = Quaternion.AngleAxis(_currentVelocity.magnitude * RunLeanAmount, runTiltAxis);
            Quaternion finalRot    = runTiltRot * forwardRot;
            transform.rotation = Mathfx.Damp(transform.rotation, finalRot, 0.25f, Time.deltaTime * TurnAnimationSpeed);
        }
    }
Ejemplo n.º 3
0
    private IEnumerator ScreamLoopAsync(float volumeScale, bool loop)
    {
        do
        {
            for (int i = 0; i < _screamSounds.Count; ++i)
            {
                ScreamSoundDefinition screamSound = _screamSounds[i];
                AudioSource           audioSource = GetAvailableAudioSource();
                AudioManager.ConfigureSourceForSound(audioSource, screamSound.Sound);
                AudioManager.PrepareSourceToPlay(audioSource, screamSound.Sound);
                audioSource.clip   = screamSound.Sound.RandomClip;
                audioSource.volume = 0;
                audioSource.Play();

                ScreamSoundPlayed?.Invoke(screamSound, volumeScale);

                // Wait for scream to be done or random interval
                float waitTime = _screamInterval.RandomValue;
                if (!loop)
                {
                    waitTime *= 0.5f;
                }
                while (waitTime > 0 && audioSource.isPlaying)
                {
                    waitTime          -= Time.unscaledDeltaTime;
                    audioSource.volume = Mathfx.Damp(audioSource.volume, volumeScale, 0.25f, Time.unscaledDeltaTime * 3);
                    yield return(null);
                }
            }

            yield return(null);
        } while (enabled && loop);

        _screamRoutine = null;
    }
Ejemplo n.º 4
0
    void FaceTowardTarget(Vector3 faceTarget, float faceAnimationSpeed)
    {
        Vector3 targetFoward = faceTarget - transform.position;
        Vector3 target2d     = Vector3.ProjectOnPlane(targetFoward, Vector3.up);

        Quaternion desiredForwardRot = Quaternion.LookRotation(target2d);

        transform.rotation = Mathfx.Damp(transform.rotation, desiredForwardRot, 0.25f, Time.deltaTime * faceAnimationSpeed);
    }
Ejemplo n.º 5
0
 private void Update()
 {
     for (int i = 0; i < _customerOrderPanelList.Count; ++i)
     {
         Vector3    panelDesiredPos = GetPanelSlotLocation(i);
         GameObject panelObj        = _customerOrderPanelList[i];
         panelObj.transform.position = Mathfx.Damp(panelObj.transform.position, panelDesiredPos, 0.5f, Time.deltaTime);
     }
 }
Ejemplo n.º 6
0
    private void Update()
    {
        _fps = Mathfx.Damp(_fps, 1.0f / Time.smoothDeltaTime, 0.25f, Time.deltaTime * 5.0f);

        if (Input.GetKeyDown(KeyCode.F1) && _fpsTextUI != null)
        {
            _fpsTextUI.enabled = !_fpsTextUI.enabled;
        }
    }
Ejemplo n.º 7
0
    private void Update()
    {
        IsVisible            = !_autoHidden && _visibleStack > 0;
        _cursorImage.enabled = IsVisible;
        Cursor.visible       = false;

        Cursor.lockState = _visibleStack > 0 ? CursorLockMode.None : CursorLockMode.Locked;

        // Convert real cursor coords to canvas
        Vector3 cursorNormalized = Input.mousePosition;

        cursorNormalized.x /= Screen.width;
        cursorNormalized.y /= Screen.height;
        cursorNormalized.z  = 0;

        _lastMouseDelta = Input.mousePosition - _lastMousePos;
        _lastMousePos   = Input.mousePosition;

        Vector3 cursorPos = cursorNormalized;

        cursorPos.x *= _canvasRect.rect.width;
        cursorPos.y *= _canvasRect.rect.height;

        // Debug.Log($"Input mouse pos {Input.mousePosition.x}x{Input.mousePosition.y}");
        // Debug.Log($"Screen size {Screen.width}x{Screen.height}");
        // Debug.Log($"Canvas rect {_canvasRect.rect.width}x{_canvasRect.rect.height}");
        // Debug.Log($"Normalized pos {cursorNormalized.x}x{cursorNormalized.y}");
        // Debug.Log($"Cursor pos {cursorPos.x}x{cursorPos.y}");

        // Auto hide when mouse doesn't move
        _autoHidden = _autoHideTimer >= _autoHideTime;
        if (Mathf.Approximately(CursorDelta.x, 0) &&
            Mathf.Approximately(CursorDelta.y, 0))
        {
            _autoHideTimer += Time.unscaledDeltaTime;
        }
        else
        {
            _autoHideTimer = 0;
        }

        // Position cursor icon
        _cursorRect.anchoredPosition = cursorPos;

        // Click animation
        if (Input.GetKey(KeyCode.Mouse0))
        {
            _targetScale = 1.5f;
        }
        else
        {
            _targetScale = 1;
        }

        _cursorRect.localScale = Mathfx.Damp(_cursorRect.localScale, Vector3.one * _targetScale, 0.25f, Time.unscaledDeltaTime * 20.0f);
    }
Ejemplo n.º 8
0
    private void Update()
    {
        Camera  cam          = CameraControllerStack.Instance.Camera;
        Vector3 focusCenter  = Vector3.zero;
        float   zoomDelta    = 0;
        bool    anyOffscreen = false;

        for (int i = 0; i < CameraFocusPoint.Instances.Count; ++i)
        {
            CameraFocusPoint focusPoint = CameraFocusPoint.Instances[i];
            focusCenter += focusPoint.transform.position;

            // Get centered viewport pos
            Vector3 viewportPos = cam.WorldToViewportPoint(focusPoint.transform.position);
            viewportPos -= Vector3.one * 0.5f;
            viewportPos *= 2;

            // Increase amount of desired zoom by how much player is off screen
            // If any players are offscreen we will never zoom in regardless
            float maxViewPos = Mathf.Max(Mathf.Abs(viewportPos.x), Mathf.Abs(viewportPos.y));
            float delta      = Mathf.Clamp((maxViewPos + ViewportBorder) - 1, -1, 1) * ZoomSensitivity;
            if (delta > 0 || anyOffscreen)
            {
                anyOffscreen = true;
                zoomDelta    = Mathf.Max(zoomDelta + delta, 0);
            }
            else
            {
                zoomDelta += delta;
            }
        }

        if (CameraFocusPoint.Instances.Count > 0)
        {
            focusCenter /= CameraFocusPoint.Instances.Count;
        }

        Debug.DrawLine(MountPoint.position, focusCenter);

        float desiredZoom = ZoomRange.Clamp(MountPoint.position.y + zoomDelta);

        _zoom = Mathfx.Damp(_zoom, desiredZoom, 0.25f, Time.deltaTime * 2);
        Vector3 desiredPos   = focusCenter.WithY(_zoom);
        Vector3 toDesiredPos = MountPoint.position - desiredPos;

        if (toDesiredPos.sqrMagnitude > 0.1f)
        {
            MountPoint.position = Mathfx.Damp(MountPoint.position, desiredPos, 0.5f, Time.deltaTime * 2);
        }
        else
        {
            MountPoint.position = desiredPos;
        }
    }
Ejemplo n.º 9
0
    private void Update()
    {
        if (!Rewired.ReInput.isReady)
        {
            return;
        }

        Rewired.Player player = Rewired.ReInput.players.GetPlayer(0);

        if (IsDragging)
        {
            // If current dragged thing was destroyed, cancel drag
            if (_currentDraggable == null)
            {
                StopDrag();
                return;
            }

            float   distanceScale  = Vector3.Distance(Camera.main.transform.position, _currentDraggable.position);
            float   horizontalAxis = player.GetAxis("CursorX") * Time.deltaTime * _handDragSensitivity;
            float   verticalAxis   = player.GetAxis("CursorY") * Time.deltaTime * _handDragSensitivity;
            Vector3 cameraMovement = Camera.main.transform.position - _dragStartCameraPos;
            _targetHandPos     += Camera.main.transform.right.WithY(0).normalized *horizontalAxis *distanceScale;
            _targetHandPos     += Camera.main.transform.forward.WithY(0).normalized *verticalAxis *distanceScale;
            _targetHandPos     += cameraMovement;
            _targetHandPos.y    = _handDragHeight;
            _dragStartCameraPos = Camera.main.transform.position;

            _isRotating = player.GetButton("Context");
        }
        else
        {
            Ray        mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hitInfo;
            bool       hit = Physics.Raycast(mouseRay, out hitInfo, 100.0f, _raycastMask);
            if (hit)
            {
                _targetHandPos = hitInfo.point + hitInfo.normal * _handHoverDistance;

                if (player.GetButtonDown("Select"))
                {
                    StartDrag(hitInfo);
                }
            }
        }

        if (player.GetButtonUp("Select"))
        {
            StopDrag();
        }

        _handObject.transform.position = Mathfx.Damp(_handObject.transform.position, _targetHandPos, 0.5f, Time.deltaTime * _handAnimateSpeed);
    }
Ejemplo n.º 10
0
    private void Update()
    {
        Vector3 targetCameraPos        = Camera.main.transform.position;
        Vector3 viewportPos            = Camera.main.ScreenToViewportPoint(Input.mousePosition);
        float   distFromViewportCenter = _panningViewThresholds.DistanceFromRange(viewportPos.x);

        targetCameraPos.x += distFromViewportCenter * _panningSpeed;
        targetCameraPos.x  = Mathf.Clamp(targetCameraPos.x, _panningWorldBounds.MinValue, _panningWorldBounds.MaxValue);

        float panSpeed = Time.deltaTime * _panningSpeed;

        Camera.main.transform.position = Mathfx.Damp(Camera.main.transform.position, targetCameraPos, 0.5f, panSpeed);
    }
Ejemplo n.º 11
0
    private void UpdateVisionConeParameters()
    {
        float timeScale = _canSeePlayer ? 4.0f : 1.0f;

        float angleScale   = _canSeePlayer ? CanSeeAngleMultiplier : 1.0f;
        float desiredAngle = Mathf.Min(VisionAngleDegrees * angleScale, 170.0f);

        _currentVisionAngleDegrees = Mathfx.Damp(_currentVisionAngleDegrees, desiredAngle, 0.25f, Time.deltaTime * timeScale);

        float distanceScale   = _canSeePlayer ? CanSeeDistanceMultiplier : 1.0f;
        float desiredDistance = VisionDistance * distanceScale;

        _currentVisionDistance = Mathfx.Damp(_currentVisionDistance, desiredDistance, 0.25f, Time.deltaTime * timeScale);

        _awareness = Mathfx.Damp(_awareness, _canSeePlayer ? 1.0f : 0.0f, 0.25f, Time.deltaTime * timeScale);
    }
Ejemplo n.º 12
0
    private void Update()
    {
        if (_cameraControllers.Count > 0)
        {
            // Align camera with current mount point
            _camera.transform.localPosition = Mathfx.Damp(_camera.transform.localPosition, Vector3.zero, 0.5f, Time.unscaledDeltaTime * 3.0f);
            _camera.transform.localRotation = Mathfx.Damp(_camera.transform.localRotation, Quaternion.identity, 0.5f, Time.unscaledDeltaTime * 3.0f);

            float desiredFov = CurrentCameraController.FieldOfView;
            if (_fovStack.Count > 0)
            {
                desiredFov = _fovStack[_fovStack.Count - 1].Value;
            }

            _camera.fieldOfView = Mathfx.Damp(_camera.fieldOfView, desiredFov, 0.5f, Time.unscaledDeltaTime * 2.0f);
        }
    }
Ejemplo n.º 13
0
    private void Update()
    {
        IsVisible            = IsEnabled && !_autoHidden;
        _cursorImage.enabled = IsVisible;
        Cursor.visible       = false;

        // Convert real cursor coords to canvas
        Vector3 cursorNormalized = Input.mousePosition;

        cursorNormalized.x /= Screen.width;
        cursorNormalized.y /= Screen.height;
        cursorNormalized.z  = 0;

        Vector3 cursorPos = cursorNormalized;

        cursorPos.x *= _canvasRect.rect.width;
        cursorPos.y *= _canvasRect.rect.height;

        // Auto hide when mouse doesn't move
        _autoHidden = _autoHideTimer >= _autoHideTime;
        if (Mathf.Approximately(_cursorRect.anchoredPosition.x, cursorPos.x) &&
            Mathf.Approximately(_cursorRect.anchoredPosition.x, cursorPos.x))
        {
            _autoHideTimer += Time.unscaledDeltaTime;
        }
        else
        {
            _autoHideTimer = 0;
        }

        // Position cursor icon
        _cursorRect.anchoredPosition = cursorPos;

        // Click animation
        if (Input.GetKey(KeyCode.Mouse0))
        {
            _targetScale = 1.5f;
        }
        else
        {
            _targetScale = 1;
        }

        _cursorRect.localScale = Mathfx.Damp(_cursorRect.localScale, Vector3.one * _targetScale, 0.5f, Time.unscaledDeltaTime * 10.0f);
    }
Ejemplo n.º 14
0
    private IEnumerator FadeAsync()
    {
        if (_canvasGroup == null)
        {
            _canvasGroup       = gameObject.AddComponent <CanvasGroup>();
            _canvasGroup.alpha = 1;
        }

        float targetAlpha = _fadeStack > 0 ? 0 : 1;

        while (_canvasGroup.alpha != targetAlpha)
        {
            _canvasGroup.alpha = Mathfx.Damp(_canvasGroup.alpha, targetAlpha, 0.25f, Time.unscaledDeltaTime * 3);
            yield return(null);
        }

        _fadeRoutine = null;
    }
Ejemplo n.º 15
0
    private void Update()
    {
        if (_cameraControllers.Count > 0)
        {
            // Align camera with current mount point
            _camera.transform.localPosition = Mathfx.Damp(_camera.transform.localPosition, Vector3.zero, 0.5f, Time.unscaledDeltaTime * 3.0f);
            _camera.transform.localRotation = Mathfx.Damp(_camera.transform.localRotation, Quaternion.identity, 0.5f, Time.unscaledDeltaTime * 3.0f);

            float desiredFov = CurrentCameraController.FieldOfView;
            if (_fovStack.Count > 0)
            {
                desiredFov = _fovStack[_fovStack.Count - 1].Value;
            }

            _camera.fieldOfView = Mathfx.Damp(_camera.fieldOfView, desiredFov, 0.25f, Time.unscaledDeltaTime * 2.0f);
        }

        _shakeTimer -= Time.unscaledDeltaTime;
        if (_shakeTimer > 0)
        {
            float shakeT = Mathf.Clamp01(_shakeTimer / _shakeTime);
            _camera.transform.position += Random.onUnitSphere * Random.value * _shakeMagnitude * shakeT;
        }
    }
Ejemplo n.º 16
0
 private void Update()
 {
     _animator.SetFloat(kAnimLocomotionSpeed, Mathfx.Damp(_animator.GetFloat(kAnimLocomotionSpeed), (float)_currentLocomotionSpeed, 0.25f, Time.deltaTime * 5));
     _animator.SetFloat(kAnimLocomotionState, Mathfx.Damp(_animator.GetFloat(kAnimLocomotionState), (float)_currentLocomotionState, 0.25f, Time.deltaTime * 5));
 }
Ejemplo n.º 17
0
    private void Update()
    {
        // Orient to face movement direction
        if (_rb.velocity.sqrMagnitude > 0.01f && !IsStunned)
        {
            Quaternion desiredRot = Quaternion.LookRotation(_rb.velocity, Vector3.up);
            transform.rotation = Mathfx.Damp(transform.rotation, desiredRot, 0.25f, Time.deltaTime * 5);
        }

        // Roll based on movement
        float targetZRot = Mathf.Abs(_moveVector.x) > 0.1f ? Mathf.Sign(_moveVector.x) * -90 : 0;

        if (IsStunned || _roomInhabitant.IsBeingSuckedIntoSpace)
        {
            targetZRot = 0;
        }

        _zRot = Mathfx.Damp(_zRot, targetZRot, 0.5f, Time.deltaTime * 5);
        _visualRoot.localEulerAngles = _visualRoot.localEulerAngles.WithZ(_zRot);

        // Update idle anim state
        if (_roomInhabitant.IsBeingSuckedIntoSpace)
        {
            _currentIdleState = AstronautIdle.Panic;
        }
        else if (IsStunned)
        {
            _currentIdleState = AstronautIdle.Stunned;
        }
        else if (_moveVector.sqrMagnitude > 0.01f)
        {
            _currentIdleState = AstronautIdle.Move;
        }
        else
        {
            _currentIdleState = AstronautIdle.Idle;
        }

        // Blend idle state
        _idleBlend = Mathfx.Damp(_idleBlend, (float)_currentIdleState, 0.25f, Time.deltaTime * 5);
        _animator.SetFloat(kAnimIdleState, _idleBlend);

        // Handle sucked into space
        if (_roomInhabitant.IsBeingSuckedIntoSpace)
        {
            if (_hideOnDie[0].activeSelf)
            {
                foreach (GameObject obj in _hideOnDie)
                {
                    obj.SetActive(false);
                }

                foreach (GameObject obj in _showOnDie)
                {
                    obj.SetActive(true);
                }
            }

            _deathTimer += Time.deltaTime;
            if (!_isDead && (_roomInhabitant.Room == null || _deathTimer > 5))
            {
                _rb.AddForce(Vector3.up * 5, ForceMode.VelocityChange);
                _rb.AddTorque(Random.onUnitSphere * 1, ForceMode.VelocityChange);
                _isDead = true;

                if (_deathSound)
                {
                    AudioManager.Instance.PlaySound(gameObject, _deathSound);
                }

                Died?.Invoke();
            }

            if (_isDead && (!Mathfx.IsPointInViewport(transform.position, Camera.main) || _deathTimer > 10))
            {
                StartCoroutine(DieAsync());
                return;
            }
        }

        if (_stunFx != null)
        {
            _stunFx.SetActive(IsStunned);
        }

        if (!_roomInhabitant.IsBeingSuckedIntoSpace)
        {
            _attackCooldownTimer -= Time.deltaTime;
        }

        if (_exclamationEffect != null)
        {
            _exclamationEffect.SetActive(_attackCooldownTimer > 0);
        }

        _stunTimer -= Time.deltaTime;
    }
Ejemplo n.º 18
0
    private void Update()
    {
        // Age over time
        _age = Mathf.Clamp01(_age + Time.deltaTime * kAgeRate);
        CritterConstants.CreatureSize ageNewSize = CritterConstants.GetCreatureSizeAtAge(_age);
        if (ageNewSize != _size)
        {
            SetSize(ageNewSize, animate: true);
        }

        // Gain vigor, if we're old enough
        if ((int)_size >= (int)kMinVigorSize)
        {
            _vigorLevel          = Mathf.Clamp01(_vigorLevel + Time.deltaTime * kVigorGainRate);
            _vigorUI.FillPercent = _vigorLevel;
        }

        // Change direction sometimes
        _changeDirectionTimer -= Time.deltaTime;
        if (_changeDirectionTimer < 0)
        {
            _changeDirectionTimer = _changeDirTimeRange.RandomValue;
            _desiredDirection     = Random.onUnitSphere.WithY(0).normalized;
            _isMoving             = Random.value > _moveChance;

            if (_animator != null)
            {
                _animator.SetBool(kAnimParamIsWalking, _isMoving);
            }
        }

        // Slowly change move direction towards current desired direction / rotate to face move direction
        _moveDirection = Mathfx.Damp(_moveDirection, _desiredDirection, 0.5f, Time.deltaTime * _turnSpeed).WithY(0);

        if (_moveDirection.magnitude > 0.1f)
        {
            Quaternion desiredRot = Quaternion.LookRotation(_moveDirection, Vector3.up);
            _rigidBody.rotation = Mathfx.Damp(_rigidBody.rotation, desiredRot, 0.5f, Time.deltaTime * _turnSpeed);
        }

        // Occaisonally raycast for obstacles
        _obstacleRaycastTimer -= Time.deltaTime;
        if (_obstacleRaycastTimer < 0)
        {
            _obstacleRaycastTimer = 2;

            RaycastHit hitInfo;
            if (Physics.Raycast(transform.position, _desiredDirection, out hitInfo, _obstacleAvoidDistance, _obstacleMask))
            {
                _desiredDirection     = Quaternion.Euler(0, 90, 0) * _desiredDirection;
                _changeDirectionTimer = _changeDirTimeRange.MaxValue;
                Debug.DrawLine(transform.position, hitInfo.point, Color.red, 1.0f);
            }
            else
            {
                Debug.DrawRay(transform.position, _desiredDirection * _obstacleAvoidDistance, Color.white, 0.5f);
            }
        }

        // If we have full vigor, look for the closest mate and go get em
        if (IsReadyForLove)
        {
            if (_mateSearchIndex >= _instances.Count)
            {
                _mateSearchIndex = 0;
            }

            // Find nearest available mate lazily over time
            if (_mateSearchIndex < _instances.Count)
            {
                CritterController potentialMate = _instances[_mateSearchIndex];
                if (potentialMate != this && potentialMate.IsReadyForLove)
                {
                    float distToMate        = Vector3.Distance(transform.position, potentialMate.transform.position);
                    float distToNearestMate = _nearestMate != null?Vector3.Distance(transform.position, _nearestMate.transform.position) : Mathf.Infinity;

                    if (distToMate < distToNearestMate)
                    {
                        _nearestMate = potentialMate;
                    }
                }

                ++_mateSearchIndex;
            }

            // Move towards current desired mate
            if (_nearestMate != null)
            {
                Vector3 toMateVec = _nearestMate.transform.position - transform.position;
                _changeDirectionTimer = 1;
                _isMoving             = true;
                _desiredDirection     = toMateVec.normalized;

                // If someone gets to our potential mate first we have to try for someone else
                if (!_nearestMate.IsReadyForLove)
                {
                    _nearestMate = null;
                    return;
                }

                // If we get close enough, begin the process
                float distToMate = toMateVec.magnitude;
                if (distToMate < kMinMateDistance)
                {
                    MateWith(_nearestMate, isLeader: true);
                }
            }
        }

        Debug.DrawRay(transform.position, _desiredDirection, Color.blue);
    }
Ejemplo n.º 19
0
    private void Update()
    {
        GameStage nextGameStage = _gameStage;

        switch (_gameStage)
        {
          case GameStage.MainMenu:
          case GameStage.Settings:
        break;
          case GameStage.DayIntro:
        if (_dayIntroUIHander.IsComplete())
        {
          nextGameStage = GameStage.Daytime;
        }
        break;
          case GameStage.Daytime:
        if (_playerSanity.EnemyPursuitCount > 0)
        {
          _musicHighInstance.AudioSource.volume = Mathfx.Damp(_musicHighInstance.AudioSource.volume, MusicHigh.VolumeScale, 0.25f, Time.deltaTime);
          _musicMidInstance.AudioSource.volume = Mathfx.Damp(_musicMidInstance.AudioSource.volume, 0f, 0.25f, Time.deltaTime);
          _musicLowInstance.AudioSource.volume = Mathfx.Damp(_musicLowInstance.AudioSource.volume, 0f, 0.25f, Time.deltaTime);
        }
        else if (PlayerCharacterController.Instance.IsSneaking)
        {
          _musicHighInstance.AudioSource.volume = Mathfx.Damp(_musicHighInstance.AudioSource.volume, 0f, 0.25f, Time.deltaTime);
          _musicMidInstance.AudioSource.volume = Mathfx.Damp(_musicMidInstance.AudioSource.volume, 0f, 0.25f, Time.deltaTime);
          _musicLowInstance.AudioSource.volume = Mathfx.Damp(_musicLowInstance.AudioSource.volume, MusicLow.VolumeScale, 0.25f, Time.deltaTime);
        }
        else
        {
          _musicHighInstance.AudioSource.volume = Mathfx.Damp(_musicHighInstance.AudioSource.volume, 0f, 0.25f, Time.deltaTime);
          _musicMidInstance.AudioSource.volume = Mathfx.Damp(_musicMidInstance.AudioSource.volume, MusicMid.VolumeScale, 0.25f, Time.deltaTime);
          _musicLowInstance.AudioSource.volume = Mathfx.Damp(_musicLowInstance.AudioSource.volume, 0f, 0.25f, Time.deltaTime);
        }

        if (!_playerSanity.HasSanityRemaining)
        {
          nextGameStage = GameStage.LoseGame;
        }
        else if (_screamBank != null && _screamBank.HasReachedScreamNoteGoal)
        {
          if (_currentDay + 1 >= TotalDays)
          {
            nextGameStage = GameStage.WinGame;
          }
          else
          {
            nextGameStage = GameStage.DayOutro;
          }
        }
        break;
          case GameStage.DayOutro:
        if (_dayOutroUIHander.IsComplete())
        {
          nextGameStage = GameStage.DayIntro;
        }
        break;
          case GameStage.WinGame:
        break;
          case GameStage.LoseGame:
        break;
        }

        SetGameStage(nextGameStage);
    }