private void HandleInput() { //TODO figure out a better to solve the jump problem if (Input.GetKey(KeyCode.Space)) { Jump = true; } if (Input.GetKey(KeyCode.F)) { CanMoveStone = true; } //place hoder for attack if (Input.GetKey(KeyCode.Q)) { SoundController.PlaySound(1); } if (Input.GetKey(KeyCode.F1)) { SaveAndLoadUtil.SavePlayerStatus(); } if (Input.GetKey(KeyCode.F2)) { SaveAndLoadUtil.LoadPlayerStatus(); } if (Input.GetKeyDown(KeyCode.F3)) //damage { GetDamage(); } }
// // Summary: // listen the input from keyboard and mouse private void HandleInput() { //melee attack if ((blockStatements[4] == 0) && (blockStatements[0] == 0)) { if (Input.GetMouseButtonDown(0)) { m_animator.SetTrigger("attack"); playerAttack = true; } } // fu attack if ((blockStatements[5] == 0) && (blockStatements[0] == 0)) { } m_directionInput = Vector3.zero; if (blockStatements[0] == 0) { float horizontalInput = 0f; if ((blockStatements[1] == 0) && Input.GetAxisRaw("Horizontal") < 0) // not block left { horizontalInput = Input.GetAxisRaw("Horizontal"); } else if ((blockStatements[2] == 0) && Input.GetAxisRaw("Horizontal") > 0) // not block right { horizontalInput = Input.GetAxisRaw("Horizontal"); } m_directionInput = new Vector2(horizontalInput, Input.GetAxis("Vertical")); if (is3DMode) { float v = Input.GetAxis("Vertical"); // calculate move direction to pass to character if (m_Cam != null) { // calculate camera relative direction to move: m_CamForward = Vector3.Scale(m_Cam.forward, new Vector3(1, 0, 1)).normalized; m_Move = v * m_CamForward + horizontalInput * m_Cam.right; } else { // we use world-relative directions in the case of no main camera m_Move = v * Vector3.forward + horizontalInput * Vector3.right; } #if !MOBILE_INPUT // walk speed multiplier if (Input.GetKey(KeyCode.LeftShift)) { m_Move *= 1.5f; } #endif } if (Input.GetKeyDown(KeyCode.Space) && (blockStatements[3] == 0)) { playerJump = true; } if (Input.GetKeyDown(KeyCode.F)) { canMoveStone = true; } } // item usage if ((blockStatements[6] == 0) && (blockStatements[0] == 0)) { } if (Input.GetKey(KeyCode.F1) && (blockStatements[0] == 0)) { SaveAndLoadUtil.SavePlayerStatus(); } if (Input.GetKey(KeyCode.F2) && (blockStatements[0] == 0)) { SaveAndLoadUtil.LoadPlayerStatus(); } }