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; } } }
private void Update() { bool changed = false; if (input.GetKeyDown(KeyCode.W)) { size++; changed = true; } if (input.GetKeyDown(KeyCode.S)) { size--; changed = true; } if (input.GetKeyDown(KeyCode.A)) { minePercentage -= 0.02f; minePercentage = Mathf.Max(0, minePercentage); changed = true; } if (input.GetKeyDown(KeyCode.D)) { minePercentage += 0.02f; minePercentage = Mathf.Min(1, minePercentage); changed = true; } for (int i = 1; i <= 9; i++) { if (input.GetKeyDown(KeyCode.Alpha0 + i)) { if (lastNumber == 0) { lastNumber = i; } else { levelCode = $"{lastNumber}-{i}"; lastNumber = 0; changed = true; } } } if (changed) { SetUpLevel(levelCode, size, minePercentage); } }
private void Update() { if (defaultInput.GetKeyDown(KeyCode.Return)) { input.gameObject.SetActive(true); input.Select(); input.ActivateInputField(); FocusManager.currentFocus = "Chat"; } else if (chatInput.GetKeyDown(KeyCode.Return)) { string message = input.text; if (message != "") { ChatManager.instance.SendGlobalMessage(message); } input.text = ""; input.gameObject.SetActive(false); FocusManager.currentFocus = "Default"; } }
private void Update() { if (mineField == null) { return; } if (input.GetKeyDown(KeyCode.R)) { ResetField(); return; } TileControl currentTileUnderMouse = GetTileUnderMouse(); if (!mineField.hasWon && !mineField.hasLost) { if (mouseState == MouseState.NoAction) { UpdateDuringNoAction(currentTileUnderMouse); } if (mouseState == MouseState.Pressing) { UpdateDuringPressing(currentTileUnderMouse); } if (mouseState == MouseState.DoublePressing) { UpdateDuringDoublePressing(currentTileUnderMouse); } } if (input.GetMouseButtonDown(0) && currentTileUnderMouse != null && currentTileUnderMouse.tile.state == MineFieldModel.TileState.Exploded && currentTileUnderMouse.isExploding) { currentTileUnderMouse.ToggleExplodeCountDownPaused(); } previousTileUnderMouse = currentTileUnderMouse; UpdateMouseRotationFactor(); UpdateUI(); }