void FixedUpdate() { // We want lerping to occur in fixed intervals if (cameraState == CAMERA_STATE.LERPING_TO_LOCK_CAM) { SetCursorLock(); } else if (cameraState == CAMERA_STATE.LERPING_TO_FREE_CAM) { SetCursorLock(); } else if (cameraState == CAMERA_STATE.FREE_CAM) { // player cam and player interact are very closely coupled // TODO: Split them apart or put them together, just end this silly message passing. //playerInteract.centerObjectInCamera (); LookRotation(gameObject.transform, Camera.main.transform); } else if (cameraState == CAMERA_STATE.LOCK_CAM) { SetCursorLock(); } inputState = CURRENT_INPUT.NONE; }
void Update() { // Debug.Log ("Down:" +Input.GetMouseButton(0)); if (Input.GetMouseButtonDown(0)) { inputState = CURRENT_INPUT.INTERACT_DOWN; } else if (Input.GetMouseButton(0)) { inputState = CURRENT_INPUT.INTERACT_HELD; } else if (Input.GetMouseButtonUp(0)) { inputState = CURRENT_INPUT.INTERACT_UP; } else if (Input.GetMouseButtonDown(1)) { inputState = CURRENT_INPUT.CANCEL_INTERACT; } else { inputState = CURRENT_INPUT.NONE; } deltaX = CrossPlatformInputManager.GetAxis("Mouse X"); deltaY = CrossPlatformInputManager.GetAxis("Mouse Y"); }
void Start() { m_CharacterTargetRot = gameObject.transform.rotation; m_CameraTargetRot = Camera.main.transform.rotation; smooth = false; cameraState = CAMERA_STATE.FREE_CAM; playerMove = gameObject.GetComponent <PlayerMove> (); inputState = CURRENT_INPUT.NONE; deltaX = 0f; deltaY = 0f; Application.targetFrameRate = 90; }
void FixedUpdate() { if (Input.GetMouseButtonDown(0)) { inputState = CURRENT_INPUT.INTERACT_DOWN; } else if (Input.GetMouseButton(0)) { inputState = CURRENT_INPUT.INTERACT_HELD; } else if (Input.GetMouseButtonUp(0)) { inputState = CURRENT_INPUT.INTERACT_UP; } else if (Input.GetMouseButtonDown(1)) { inputState = CURRENT_INPUT.CANCEL_INTERACT; } else { inputState = CURRENT_INPUT.NONE; } deltaX = CrossPlatformInputManager.GetAxis("Mouse X"); deltaY = CrossPlatformInputManager.GetAxis("Mouse Y"); // We want lerping to occur in fixed intervals if (cameraState == CAMERA_STATE.LERPING_TO_LOCK_CAM) { SetCursorLock(); } else if (cameraState == CAMERA_STATE.LERPING_TO_FREE_CAM) { SetCursorLock(); } else if (cameraState == CAMERA_STATE.FREE_CAM) { if (goal) { GoalRotation(gameObject.transform, cam.transform); } else { LookRotation(gameObject.transform, cam.transform); } } else if (cameraState == CAMERA_STATE.LOCK_CAM) { SetCursorLock(); } inputState = CURRENT_INPUT.NONE; }