public void DisableMenus() { PointerLock.SetMode(PointerLock.Mode.FIRST_PERSON); PropertiesPanel.Instance.gameObject.SetActive(false); mainMenu.SetActive(false); hideMenuButton.gameObject.SetActive(false); }
public void EnableMenus() { PointerLock.SetMode(PointerLock.Mode.DEFAULT); PropertiesPanel.Instance.gameObject.SetActive(true); mainMenu.SetActive(true); hideMenuButton.gameObject.SetActive(true); }
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); }
void Update() { if (PointerLock.GetMode() == PointerLock.Mode.FIRST_PERSON) { CheckPhysics(); CheckInput(); transform.position += velocity * Time.deltaTime; } }
void Update() { #if !UNITY_WEBGL || UNITY_EDITOR if (Input.GetKeyDown(KeyCode.Escape) && PointerLock.GetMode() == PointerLock.Mode.FIRST_PERSON) { EnableMenus(); } #endif if (PointerLock.GetMode() == PointerLock.Mode.FIRST_PERSON) { FollowMouseRotation(); } }
public void GodViewMode() { PointerLock.SetMode(PointerLock.Mode.DEFAULT); this.CameraMode = CameraMode.GodView; Vector3 currentPosition = currentCamera.transform.position; Quaternion rot = currentCamera.transform.rotation; currentCamera.SetActive(false); currentCamera = godViewCam; currentCamera.transform.position = currentPosition; currentCamera.transform.rotation = rot; currentCamera.SetActive(true); CurrentCameraExtends = currentCamera.GetComponent <ICameraExtents>(); CurrentCameraControls = currentCamera.GetComponent <ICameraControls>(); ActiveCamera = currentCamera.GetComponent <Camera>(); OnGodViewModeEvent?.Invoke(); TransitionCamera(currentCamera.transform, currentPosition + Vector3.up * 400, oldGodViewRotation, true); }
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); }