private void FixedUpdate() { if (_gameStatuses.Status().Equals(GameStatus.Playing)) { _movementController.Move(_horizontalMove * Time.fixedDeltaTime, _jump); _jump = false; } }
private void Update() { if (_gameStatuses.Status() == GameStatus.LevelEnd) { _camera.fieldOfView = Mathf.Lerp(_camera.fieldOfView, _zoom, _smooth * Time.deltaTime); } }
private void FixedUpdate() { if (_gameStatuses.Status() == GameStatus.Playing) { Vector3 targetPos = _target.position; //Keep camera position in granted values if (_yMaxEnabled && _yMinEnabled) { targetPos.y = Mathf.Clamp(_target.position.y, _yMin, _yMax); } else if (_yMinEnabled) { targetPos.y = Mathf.Clamp(_target.position.y, _yMin, _target.position.y); } else if (_yMaxEnabled) { targetPos.y = Mathf.Clamp(_target.position.y, _target.position.y, _yMax); } if (_xMaxEnabled && _xMinEnabled) { targetPos.x = Mathf.Clamp(_target.position.x, _xMin, _xMax); } else if (_xMinEnabled) { targetPos.x = Mathf.Clamp(_target.position.x, _xMin, targetPos.x); } else if (_xMaxEnabled) { targetPos.x = Mathf.Clamp(_target.position.x, targetPos.x, _xMax); } targetPos.z = _cameraTransform.position.z; _cameraTransform.position = Vector3.SmoothDamp(_cameraTransform.position, targetPos, ref _curVelocity, _movementSmoothing); } }