// Update is called once per frame void Update() { owner.Move(Input.GetAxis("Horizontal")); if (Input.GetKeyDown(KeyCode.Space)) { owner.Jump(); } }
private void Update() { if (StaticVars.controlActive == true) { if (Input.GetButtonDown("Jump")) { jumpOn(); } if (Input.GetButton("Jump")) { jumpHold(); } if (Input.GetButtonUp("Jump")) { jumpOff(); } if (Input.GetButtonDown("Fire1")) { attack(); } if (Input.GetAxis("Vertical") >= 0.01f) { crouchOn(); } if (Input.GetAxis("Vertical") <= 0.01f) { crouchOff(); } if (Input.GetAxis("Vertical") <= -0.01f) { upKeyOn(); } if (Input.GetAxis("Vertical") >= -0.01f) { upKeyOff(); } //Move float h = Input.GetAxis("Horizontal"); m_Character.Move(h); } }
private void FixedUpdate() { float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); m_crouch = Input.GetButton("Crouch"); Vector2 mouseAxis; mouseAxis = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); m_CamForward = Vector3.Scale(m_Cam.forward, new Vector3(1, 0, 1)).normalized; m_Move = v * m_CamForward + h * m_Cam.right; m_Character.Move(m_Move, m_crouch, m_jump); m_camControl.RotateCamera(mouseAxis.x, mouseAxis.y); m_jump = false; }