public void UpdateKeyboard() { if (StopInput) { Direction = Vector2.zero; Jump = false; Sprint = false; DodgeLeft = false; DodgeRight = false; return; } // We get our horizontal/vertical inputs as integers so we don't have to deal with floating point value errors Direction.x = (int)(Sprint ? 0 : Inputs.GetAxis("Horizontal")); Direction.y = (int)(Sprint ? 1 : Inputs.GetAxis("Vertical")); Jump = Inputs.GetButtonDown("Jump"); HoldJump = Inputs.GetButton("Jump"); if (Inputs.GetButtonDoublePressDown("Vertical")) { Sprint = true; } else if (Inputs.GetButtonUp("Vertical") || Jump || AnyAttack) { Sprint = false; } // Reset the dodge bools before we use it DodgeLeft = false; DodgeRight = false; if (Settings.GameSettingsManager.Instance.ControlSettings.Save.ControlDoubleTapDodge != 0) { DodgeLeft = Inputs.GetNegativeButtonDoublePressDown("Horizontal") && !DodgeRight; DodgeRight = Inputs.GetButtonDoublePressDown("Horizontal") && !DodgeLeft; } else { DodgeLeft = Direction.x < 0 && Direction.y == 0 && Jump && !DodgeRight; DodgeRight = Direction.x > 0 && Direction.y == 0 && Jump && !DodgeLeft; } if (Inputs.GetButtonDown("Camera Side")) { CameraSide = !CameraSide; } // Select Weapon if (Inputs.GetButtonDown("Weapon 1")) { WeaponNumber = 0; } if (Inputs.GetButtonDown("Weapon 2")) { WeaponNumber = 1; } if (Inputs.GetButtonDown("Weapon 3")) { WeaponNumber = 2; } // Scroll Weapon if (Inputs.GetAxis("Scroll Weapon") * MouseScrollSpeed >= 1) { WeaponNumber--; } else if (Inputs.GetAxis("Scroll Weapon") * MouseScrollSpeed <= -1) { WeaponNumber++; } // Infinite scroll allows us to go to the first weapon if we attempt to scroll down on the last weapon if (Settings.GameSettingsManager.Instance.ControlSettings.Save.ControlWeaponSwitchInfiniteScroll != 0) { // Just reset the number WeaponNumber = WeaponNumber > 2 ? 0 : WeaponNumber < 0 ? 2 : WeaponNumber; } WeaponNumber = Mathf.Clamp(WeaponNumber, 0, 2); }