void Update() { // check back button //if (Input.GetKey(KeyCode.Escape)) //{ // Pause(); //} #region input in the editor #if UNITY_EDITOR if (!useEditorInput) { return; } if (Input.GetKeyDown(KeyCode.LeftShift)) { FireDown(); } else if (Input.GetKeyUp(KeyCode.LeftShift)) { FireUp(); } if (!ignoreMovementInput) { float x = Input.GetAxis("Horizontal"); MovementHorizontal = x; OnMovementHorizontal?.Invoke(MovementHorizontal); } bool pressedRight = Input.GetKey(KeyCode.E) || Input.GetKey(KeyCode.UpArrow); bool pressedLeft = Input.GetKey(KeyCode.Q) || Input.GetKey(KeyCode.DownArrow); if (pressedLeft || pressedRight) { var w = FindObjectOfType <WeaponsController>(); if (w == null) { return; } //if (!w.IsBusy()) { if (w.GetCurrentWeapon(out WeaponIndex current)) { if (w.GetNextAvailable(current, out WeaponIndex available, pressedRight)) { SelectWeapon(available); } } } } #endif #endregion }
public void UpdateMovementInput(float x) { MovementHorizontal = x; OnMovementHorizontal?.Invoke(MovementHorizontal); }