private void UpdateMouseRotationFactor() { bool inverseControl = input.GetKey(KeyCode.LeftControl) || input.GetKey(KeyCode.RightControl); Globals.instance.observeCamera.mouseRotationFactor = mouseState == MouseState.NoAction ? mouseRotationFactorNoAction : mouseRotationFactorPressing; Globals.instance.observeCamera.mouseRotationControlDistance = inverseControl ? -mouseRotationControlDistance : mouseRotationControlDistance; }
private void Update() { if (chessModel != null && chessModel.isInitiated && input.GetKeyDown(KeyCode.R)) { Restart(); } if (chessModel != null && chessModel.isInitiated && input.GetKeyDown(KeyCode.Q) && mode != Mode.Client) { ChessMain.instance.Reconfigure(); } if (HasFreeControl()) { bool nextObserveMode = input.GetKey(KeyCode.Space); if (nextObserveMode != observeMode) { observeMode = nextObserveMode; if (IsMyTurn() && opponent != null) { opponent.Send(new ObserveModeRequest(observeMode)); } } } if (IsMyTurn() && opponent != null) { cameraRequestTimer -= Time.deltaTime; if (cameraRequestTimer <= 0 && (mainCamera.targetDistance != lastCameraDistance || mainCamera.targetRotation != lastCameraRotation)) { lastCameraDistance = mainCamera.targetDistance; lastCameraRotation = mainCamera.targetRotation; opponent.Send(new ObserveCameraControlRequest(lastCameraDistance, lastCameraRotation)); cameraRequestTimer = 0.1f; } } }