private void Update() { GeneralOrientation generalOrientation = ScreenOrientationManager.Instance.CurrentGeneralOrientation; float z = generalOrientation == GeneralOrientation.Landscape ? landscapeZ : portraitZ; Vector3 currPos = cameraAnchor.position; Vector3 targetPos = new Vector3(currPos.x, currPos.y, z); cameraAnchor.position = Vector3.Lerp(currPos, targetPos, speed * Time.deltaTime); }
private void Update() { UpdateCurrentOrientation(); if (prevOrientation != currOrientation) { if (currOrientation == ScreenOrientation.LandscapeLeft || currOrientation == ScreenOrientation.LandscapeRight) { CurrentGeneralOrientation = GeneralOrientation.Landscape; GeneralOrientationChanged?.Invoke(CurrentGeneralOrientation); } else if (currOrientation == ScreenOrientation.Portrait || currOrientation == ScreenOrientation.PortraitUpsideDown) { CurrentGeneralOrientation = GeneralOrientation.Portrait; GeneralOrientationChanged?.Invoke(CurrentGeneralOrientation); } DeviceOrientationChanged?.Invoke(currOrientation); } prevOrientation = currOrientation; }