private void ProcessBlockInput() { // hard & soft drop if (Input.GetKeyDown(KeyCode.Space)) { m_tetris.HardDrop(); // execute in one frame } else if (!up_pressed && Input.GetKeyDown(KeyCode.DownArrow)) { up_pressed = true; m_tetris.SoftDrop(); } else if (up_pressed && Input.GetKeyUp(KeyCode.DownArrow)) { up_pressed = false; m_tetris.NormalDrop(); } // move left if (Input.GetKeyDown(KeyCode.LeftArrow)) { m_tetris.MoveLeft(); left_pressed = true; } if (!right_pressed && left_pressed && Input.GetKey(KeyCode.LeftArrow)) { if (lastStartTime >= startTime) { if (lastInputTime >= inputDelta) { m_tetris.MoveLeft(); lastInputTime = 0; } else { lastInputTime += Time.deltaTime; } } else { lastStartTime += Time.deltaTime; } } if (left_pressed && Input.GetKeyUp(KeyCode.LeftArrow)) { left_pressed = false; lastStartTime = 0; lastInputTime = 0; } // move right if (Input.GetKeyDown(KeyCode.RightArrow)) { m_tetris.MoveRight(); right_pressed = true; } if (!left_pressed && right_pressed && Input.GetKey(KeyCode.RightArrow)) { if (lastStartTime >= startTime) { if (lastInputTime >= inputDelta) { m_tetris.MoveRight(); lastInputTime = 0; } else { lastInputTime += Time.deltaTime; } } else { lastStartTime += Time.deltaTime; } } if (right_pressed && Input.GetKeyUp(KeyCode.RightArrow)) { right_pressed = false; lastStartTime = 0; lastInputTime = 0; } // rotate if (Input.GetKeyDown(KeyCode.Z)) { m_tetris.AntiClockwiseRotation(); } if (Input.GetKeyDown(KeyCode.X)) { m_tetris.ClockwiseRotation(); } // hold if (Input.GetKeyDown(KeyCode.C)) { m_tetris.HoldBlock(); } // logger //if (Input.GetKeyDown(KeyCode.Return)) //{ // Tetris.logger.Print(); //} }