void Update() { FPSmotor.Aim(new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"))); FPSmotor.Move(new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"))); FPSmotor.Jump(Input.GetButton("Jump")); if (Input.GetKey(KeyCode.LeftShift)) { FPSmotor.Boost(1.7f); } FPSmotor.Holdbreath(1); if (Input.GetKey(KeyCode.LeftShift)) { FPSmotor.Holdbreath(0); } if (Input.GetButton("Fire1")) { gunHanddle.Shoot(); } if (Input.GetButtonDown("Fire2")) { gunHanddle.Zoom(); } if (Input.GetAxis("Mouse ScrollWheel") < 0) { gunHanddle.ZoomAdjust(-1); } if (Input.GetAxis("Mouse ScrollWheel") > 0) { gunHanddle.ZoomAdjust(1); } if (Input.GetKeyDown(KeyCode.R)) { gunHanddle.Reload(); } if (Input.GetKeyDown(KeyCode.Q)) { gunHanddle.SwitchGun(); } if (Input.GetKeyDown(KeyCode.Z)) { gunHanddle.OffsetAdjust(new Vector2(0, -1)); } if (Input.GetKeyDown(KeyCode.X)) { gunHanddle.OffsetAdjust(new Vector2(0, 1)); } if (Input.GetKeyDown(KeyCode.C)) { gunHanddle.OffsetAdjust(new Vector2(-1, 0)); } if (Input.GetKeyDown(KeyCode.V)) { gunHanddle.OffsetAdjust(new Vector2(1, 0)); } }
void Update() { if (FPSmotor == null || FPSmotor.character == null || !MouseLock.MouseLocked) { return; } // move input FPSmotor.Move(new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"))); // jump input //FPSmotor.Jump (Input.GetButton ("Jump")); // sprint input if (Input.GetKey(KeyCode.LeftShift)) { FPSmotor.Boost(1.4f); } if (MouseLock.MouseLocked) { // aim input work only when mouse is locked FPSmotor.Aim(new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"))); } }
void Update() { if (FPSmotor == null || FPSmotor.character == null) { return; } // Debug.Log("FPSmotor "+FPSmotor); //FPSItemEquipment FPSitem = null; FPSmotor.Move(new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"))); // jump input FPSmotor.Jump(Input.GetButton("Jump")); // sprint input if (Input.GetKey(KeyCode.LeftShift)) { FPSmotor.Boost(1.4f); // Debug.Log ("Boost "); } ItemEquipment actionItem = GetComponentInChildren <ItemEquipment>(); if (Cursor.lockState == CursorLockMode.Locked) { // aim input work only when mouse is locked FPSmotor.Aim(new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"))); // fire input if (Input.GetButton("Fire1")) { // press trigger to fire // Debug.Log("Fire1 "); actionItem.Trigger(); } else { // relesed trigger. actionItem.OnTriggerRelease(); } // fire 2 input e.g. Zoom if (Input.GetButtonDown("Fire2")) { // press trigger 2 // Debug.Log("Fire2 "); actionItem.Trigger2(); } else { // release trigger 2 actionItem.OnTrigger2Release(); } } // interactive input e.g. pickup item if (Input.GetKeyDown(KeyCode.F)) { } // reload input if (Input.GetKeyDown(KeyCode.R)) { actionItem.Reload(); } }