Exemplo n.º 1
0
        public void FirstPersonMode(Vector3 position, Quaternion rotation)
        {
            PointerLock.SetMode(PointerLock.Mode.FIRST_PERSON);

            var gridSelection = FindObjectOfType <GridSelection>();

            if (gridSelection)
            {
                gridSelection.gameObject.SetActive(false);
            }

            this.CameraMode = CameraMode.StreetView;

            Vector3    oldPosition = currentCamera.transform.position;
            Quaternion oldRotation = currentCamera.transform.rotation;

            oldGodViewRotation = currentCamera.transform.rotation;
            currentCamera.SetActive(false);
            currentCamera = streetView.EnableFPSCam();
            currentCamera.transform.position = oldPosition;
            currentCamera.transform.rotation = oldRotation;
            CurrentCameraControls            = currentCamera.GetComponent <ICameraControls>();
            ActiveCamera         = currentCamera.GetComponent <Camera>();
            CurrentCameraExtends = currentCamera.GetComponent <ICameraExtents>();
            OnFirstPersonModeEvent?.Invoke();
            TransitionCamera(currentCamera.transform, position, rotation);
        }
Exemplo n.º 2
0
        public void FirstPersonMode(Vector3 position, Quaternion rotation)
        {
            PointerLock.SetMode(PointerLock.Mode.FIRST_PERSON);

            SwitchTool.Instance.ResetToDefault();

            this.CameraMode = CameraMode.StreetView;

            Vector3    oldPosition = currentCamera.transform.position;
            Quaternion oldRotation = currentCamera.transform.rotation;

            oldGodViewRotation = currentCamera.transform.rotation;
            currentCamera.SetActive(false);
            currentCamera = streetView.EnableFPSCam();
            currentCamera.transform.position = oldPosition;
            currentCamera.transform.rotation = oldRotation;
            CurrentCameraControls            = currentCamera.GetComponent <ICameraControls>();
            ActiveCamera         = currentCamera.GetComponent <Camera>();
            CurrentCameraExtends = currentCamera.GetComponent <ICameraExtents>();
            OnFirstPersonModeEvent?.Invoke();
            TransitionCamera(currentCamera.transform, position, rotation);
        }