public bool CheckInput() { rtX = 0.0f; rtY = 0.0f; if (Common.isOptions || Common.isPaused) { return(false); } if (playerScript.usingXboxControl) { if (FakeInput) { rtX = MonkeyInput.GetLookFloat() * xboxSensitivity; rtY = 0; } else { rtX = (float)Input.GetValue((char)0, "RThumbX") * xboxSensitivity; rtY = (float)Input.GetValue((char)0, "RThumbY") * xboxSensitivity; } } else { if (Input.GetLockMouse()) { rtX = (float)Input.GetMouseDeltaX(); rtY = (float)-Input.GetMouseDeltaY(); } } if (rtX != 0 || rtY != 0) { return(true); } else { return(false); } }
bool CheckXBoxLeftThumbInput() { if (usingXboxControl) { if (FakeInput) { speedX = 0.0f; speedX += MonkeyInput.GetMovementXFloat(); // Input.GetHeld(0, "right"); //speedX -= MonkeyInput.GetMovementFloat(); speedZ = 0.0f; speedZ += MonkeyInput.GetMovementZFloat(); //speedZ -= MonkeyInput.GetMovementFloat(); thumbstickMagnitude = 1; } else { // update how much left thumb is pressed speedX = Input.GetValue((char)0, "LThumbX"); speedZ = Input.GetValue((char)0, "LThumbY"); Vector2 stickInput = new Vector2(speedX, speedZ); // only use values for movment if the thumbstick is out of the deadzone thumbstickMagnitude = stickInput.Length(); } } else { speedX = 0.0f; speedX += Input.GetHeld(0, "right"); speedX -= Input.GetHeld(0, "left"); speedZ = 0.0f; speedZ += Input.GetHeld(0, "up"); speedZ -= Input.GetHeld(0, "down"); thumbstickMagnitude = 1; } if (movementLocked || Common.isPaused) { speedX = 0.0f; speedZ = 0.0f; } /* * if (Common.isPaused) // Prevent player inputs when paused * { * speedX = 0.0f; * speedZ = 0.0f; * } * * * if (Common.isPaused) // Prevent player inputs when paused * { * if (prevIsPaused != Common.isPaused) * { * lastPositionToFreezeAt = gameObject.transform.GetGlobalPosition(); * playerPhysics.mIsGravityOn = false; * } * gameObject.transform.SetPosition(lastPositionToFreezeAt); * speedX = 0.0f; * speedZ = 0.0f; * } * else * { * if (prevIsPaused != Common.isPaused) * { * playerPhysics.mIsGravityOn = true; * } * } * prevIsPaused = Common.isPaused;*/ if (speedX == 0 && speedZ == 0) { return(false); } else { return(true); } }