public override void Update() { ////determine based on history //_current = InputUtil.GetNextButtonState(_current, Input.GetButton(this.UnityInputId) || Input.GetAxis(this.UnityInputId) >= this.AxisButtonDeadZone); switch (this.Consideration) { case AxleValueConsideration.Positive: _current = InputUtil.GetNextButtonState(_current, Input.GetAxis(this.UnityInputId) >= this.AxisButtonDeadZone); break; case AxleValueConsideration.Negative: _current = InputUtil.GetNextButtonState(_current, Input.GetAxis(this.UnityInputId) <= -this.AxisButtonDeadZone); break; case AxleValueConsideration.Absolute: //_current = InputUtil.GetNextButtonState(_current, Input.GetButton(this.UnityInputId) || Mathf.Abs(Input.GetAxis(this.UnityInputId)) >= this.AxisButtonDeadZone); _current = InputUtil.GetNextButtonState(_current, Mathf.Abs(Input.GetAxis(this.UnityInputId)) >= this.AxisButtonDeadZone); break; } if (_current == ButtonState.Down) { _lastDown = Time.realtimeSinceStartup; } }
public override void Update() { //determine based on history _current = InputUtil.GetNextButtonState(_current, Input.GetButton(this.UnityInputId)); if (_current == ButtonState.Down) { _lastDown = Time.realtimeSinceStartup; } }
public override void FixedUpdate() { base.FixedUpdate(); float v = base.CurrentState.sqrMagnitude; float dz = this.AxisButtonDeadZone; _currentFixed = InputUtil.GetNextButtonState(_currentFixed, v >= (dz * dz)); }
public override void Update() { //determine based on history _current = InputUtil.GetNextButtonState(_current, Input.GetMouseButton(this.MouseButton)); if (_current == ButtonState.Down) { _lastDown = Time.unscaledTime; } }
private void UpdateState(ref XboxGamePadState state) { if (_gamepadIndex < 0) { state.LeftX = Input.GetAxis(ID_LEFT_X); state.LeftY = Input.GetAxis(ID_LEFT_Y); state.LeftTrigger = Input.GetAxis(ID_TRIGGER_LEFT); state.RightX = Input.GetAxis(ID_RIGHT_X); state.RightY = Input.GetAxis(ID_RIGHT_Y); state.RightTrigger = Input.GetAxis(ID_TRIGGER_RIGHT); state.DPadUp = InputUtil.GetNextButtonState(state.DPadUp, Input.GetButton(ID_DPAD_UP)); state.DPadRight = InputUtil.GetNextButtonState(state.DPadRight, Input.GetButton(ID_DPAD_RIGHT)); state.DPadDown = InputUtil.GetNextButtonState(state.DPadDown, Input.GetButton(ID_DPAD_DOWN)); state.DPadLeft = InputUtil.GetNextButtonState(state.DPadLeft, Input.GetButton(ID_DPAD_LEFT)); state.A = InputUtil.GetNextButtonState(state.A, Input.GetButton(ID_BTN_A)); state.B = InputUtil.GetNextButtonState(state.B, Input.GetButton(ID_BTN_B)); state.X = InputUtil.GetNextButtonState(state.X, Input.GetButton(ID_BTN_X)); state.Y = InputUtil.GetNextButtonState(state.Y, Input.GetButton(ID_BTN_Y)); state.LB = InputUtil.GetNextButtonState(state.LB, Input.GetButton(ID_BTN_LB)); state.RB = InputUtil.GetNextButtonState(state.RB, Input.GetButton(ID_BTN_RB)); state.Start = InputUtil.GetNextButtonState(state.Start, Input.GetButton(ID_BTN_START)); state.Back = InputUtil.GetNextButtonState(state.Back, Input.GetButton(ID_BTN_BACK)); state.LeftStickClick = InputUtil.GetNextButtonState(state.LeftStickClick, Input.GetButton(ID_BTN_LEFTSTICK)); state.RightStickClick = InputUtil.GetNextButtonState(state.RightStickClick, Input.GetButton(ID_BTN_RIGHTSTICK)); } else { state.LeftX = Input.GetAxis(_axleToId[XboxAxleInputs.LeftStickX]); state.LeftY = Input.GetAxis(_axleToId[XboxAxleInputs.LeftStickY]); state.LeftTrigger = Input.GetAxis(_axleToId[XboxAxleInputs.LeftTrigger]); state.RightX = Input.GetAxis(_axleToId[XboxAxleInputs.RightStickX]); state.RightY = Input.GetAxis(_axleToId[XboxAxleInputs.RightStickY]); state.RightTrigger = Input.GetAxis(_axleToId[XboxAxleInputs.RightTrigger]); state.DPadUp = InputUtil.GetNextButtonState(state.DPadUp, Input.GetButton(_btnToId[XboxButtons.DPadUp])); state.DPadRight = InputUtil.GetNextButtonState(state.DPadRight, Input.GetButton(_btnToId[XboxButtons.DPadRight])); state.DPadDown = InputUtil.GetNextButtonState(state.DPadDown, Input.GetButton(_btnToId[XboxButtons.DPadDown])); state.DPadLeft = InputUtil.GetNextButtonState(state.DPadLeft, Input.GetButton(_btnToId[XboxButtons.DPadLeft])); state.A = InputUtil.GetNextButtonState(state.A, Input.GetButton(_btnToId[XboxButtons.A])); state.B = InputUtil.GetNextButtonState(state.B, Input.GetButton(_btnToId[XboxButtons.B])); state.X = InputUtil.GetNextButtonState(state.X, Input.GetButton(_btnToId[XboxButtons.X])); state.Y = InputUtil.GetNextButtonState(state.Y, Input.GetButton(_btnToId[XboxButtons.Y])); state.LB = InputUtil.GetNextButtonState(state.LB, Input.GetButton(_btnToId[XboxButtons.LB])); state.RB = InputUtil.GetNextButtonState(state.RB, Input.GetButton(_btnToId[XboxButtons.RB])); state.Start = InputUtil.GetNextButtonState(state.Start, Input.GetButton(_btnToId[XboxButtons.Start])); state.Back = InputUtil.GetNextButtonState(state.Back, Input.GetButton(_btnToId[XboxButtons.Back])); state.LeftStickClick = InputUtil.GetNextButtonState(state.LeftStickClick, Input.GetButton(_btnToId[XboxButtons.LeftStick])); state.RightStickClick = InputUtil.GetNextButtonState(state.RightStickClick, Input.GetButton(_btnToId[XboxButtons.RightStick])); } }
public override void Update() { base.Update(); float v = base.CurrentState.sqrMagnitude; float dz = this.AxisButtonDeadZone; _current = InputUtil.GetNextButtonState(_current, v >= (dz * dz)); if (_current == ButtonState.Down) { _lastDown = Time.realtimeSinceStartup; } }
public override void Update() { ////use classic way of determining //if (Input.GetKeyDown(this.Key)) // _current = ButtonState.Down; //else if (Input.GetKeyUp(this.Key)) // _current = ButtonState.Released; //else if (Input.GetKey(this.Key)) // _current = ButtonState.Held; //else // _current = ButtonState.None; //determine based on history _current = InputUtil.GetNextButtonState(_current, Input.GetKey(this.Key)); }
public override void FixedUpdate() { //_currentFixed = InputUtil.GetNextButtonState(_currentFixed, Input.GetButton(this.UnityInputId) || Input.GetAxis(this.UnityInputId) >= this.AxisButtonDeadZone); switch (this.Consideration) { case AxleValueConsideration.Positive: //_currentFixed = InputUtil.GetNextButtonState(_currentFixed, Input.GetButton(this.UnityInputId) || Input.GetAxis(this.UnityInputId) >= this.AxisButtonDeadZone); _currentFixed = InputUtil.GetNextButtonState(_currentFixed, Input.GetAxis(this.UnityInputId) >= this.AxisButtonDeadZone); break; case AxleValueConsideration.Negative: //_currentFixed = InputUtil.GetNextButtonState(_currentFixed, Input.GetButton(this.UnityInputId) || Input.GetAxis(this.UnityInputId) <= -this.AxisButtonDeadZone); _currentFixed = InputUtil.GetNextButtonState(_currentFixed, Input.GetAxis(this.UnityInputId) <= -this.AxisButtonDeadZone); break; case AxleValueConsideration.Absolute: //_currentFixed = InputUtil.GetNextButtonState(_currentFixed, Input.GetButton(this.UnityInputId) || Mathf.Abs(Input.GetAxis(this.UnityInputId)) >= this.AxisButtonDeadZone); _currentFixed = InputUtil.GetNextButtonState(_currentFixed, Mathf.Abs(Input.GetAxis(this.UnityInputId)) >= this.AxisButtonDeadZone); break; } }
public override void FixedUpdate() { //determine based on history _currentFixed = InputUtil.GetNextButtonState(_currentFixed, Input.GetButton(this.UnityInputId)); }
public override void FixedUpdate() { _currentFixed = InputUtil.GetNextButtonState(_currentFixed, Input.GetKey(this.Key)); }
public override void Update() { //determine based on history _current = InputUtil.GetNextButtonState(_current, Input.GetMouseButton(this.MouseButton)); }