public void Move(float speed) { bool moveForward = Input.GetKey(m_keyboard.GetMoveForward()); bool moveBackward = Input.GetKey(m_keyboard.GetMoveBackward()); bool strafeRight = Input.GetKey(m_keyboard.GetStrafeRight()); bool strafeLeft = Input.GetKey(m_keyboard.GetStrafeLeft()); bool mouseMove = Input.GetKeyDown(m_mouse.GetMove()); if (moveForward || moveBackward || strafeRight || strafeLeft || (m_mouse.CanMove() && mouseMove)) { m_isMoving = true; if (mouseMove) { RaycastHit raycastHit; Ray ray = m_camera.ScreenPointToRay(m_mouse.GetPositionCurrent()); if (Physics.Raycast(ray, out raycastHit, Mathf.Infinity)) { Destroy(m_arrow); m_arrow = Instantiate(m_mouse.GetArrow(), raycastHit.point, Quaternion.identity); Destroy(m_arrow, m_mouse.GetArrowDuration()); } } if (moveForward) { transform.Translate(0.0f, 0.0f, speed * Time.deltaTime); } if (moveBackward) { transform.Translate(0.0f, 0.0f, -speed * Time.deltaTime); } if (strafeRight) { transform.Translate(speed * 0.8f * Time.deltaTime, 0.0f, 0.0f); } if (strafeLeft) { transform.Translate(-speed * 0.8f * Time.deltaTime, 0.0f, 0.0f); } } else if (m_isMoving) { m_isMoving = false; } }