Example #1
0
        public override void Update()
        {
            float v = _delegate != null?_delegate() : 0f;

            switch (this.Consideration)
            {
            case AxleValueConsideration.Positive:
                _current = InputUtil.GetNextButtonState(_current, v >= this.AxisButtonDeadZone);
                break;

            case AxleValueConsideration.Negative:
                _current = InputUtil.GetNextButtonState(_current, v <= -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, v >= this.AxisButtonDeadZone);
                break;
            }

            if (_current == ButtonState.Down)
            {
                _lastDown = Time.realtimeSinceStartup;
            }
        }
 public override void Update()
 {
     //determine based on history
     _current = InputUtil.GetNextButtonState(_current, _button != null ? _button() : false);
     if (_current == ButtonState.Down)
     {
         _lastDown    = Time.realtimeSinceStartup;
         _delay       = _firstRepeatDelay;
         _repeatCount = 0;
     }
     else if (_current == ButtonState.Held && Time.realtimeSinceStartup - _lastDown > _repeatDelay)
     {
         _current  = ButtonState.Down;
         _lastDown = Time.realtimeSinceStartup;
         if (_repeatCount == 0)
         {
             _delay = _repeatDelay;
         }
         else
         {
             _delay = Mathf.Lerp(_delay, _maxRepeat, _repeatLerp);
         }
         _repeatCount++;
     }
 }
Example #3
0
 public override void Update()
 {
     //determine based on history
     _current = InputUtil.GetNextButtonState(_current, _delegate != null ? _delegate() : false);
     if (_current == ButtonState.Down)
     {
         _lastDown = Time.realtimeSinceStartup;
     }
 }
Example #4
0
        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()
        {
            _realState = InputUtil.GetNextButtonState(_realState, _delegate != null ? _delegate() : false);
            if (_count < _taps)
            {
                switch (_realState)
                {
                case ButtonState.Down:
                {
                    _count++;
                    _lastRealDown = Time.realtimeSinceStartup;

                    if (_count == _taps)
                    {
                        _current  = ButtonState.Down;
                        _lastDown = Time.realtimeSinceStartup;
                    }
                }
                break;

                default:
                    _current = ButtonState.None;
                    if (Time.realtimeSinceStartup - _lastRealDown > _delay)
                    {
                        _count = 0;
                    }
                    break;
                }
            }
            else if (_current > ButtonState.None)
            {
                switch (_realState)
                {
                case ButtonState.Released:
                case ButtonState.None:
                    _current = ButtonState.Released;
                    _count   = 0;
                    break;

                default:
                    _current = ButtonState.Held;
                    break;
                }
            }
            else
            {
                _current = ButtonState.None;
                _count   = 0;
            }
        }
Example #6
0
        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 FixedUpdate()
        {
            base.FixedUpdate();

            bool down = false;

            for (int i = 0; i < this.Signatures.Count; i++)
            {
                if (this.Signatures[i].GetCurrentState(true) >= ButtonState.Down)
                {
                    down = true;
                    break;
                }
            }
            _currentFixed = InputUtil.GetNextButtonState(_currentFixed, down);
        }
Example #8
0
        public override void FixedUpdate()
        {
            base.FixedUpdate();

            bool down = false;
            var  e    = this.SignaturesSet.GetEnumerator();

            while (e.MoveNext())
            {
                if (e.Current.GetCurrentState(false) >= ButtonState.Down)
                {
                    down = true;
                    break;
                }
            }
            _currentFixed = InputUtil.GetNextButtonState(_currentFixed, down);
        }
        public override void Update()
        {
            base.Update();

            bool down = false;

            for (int i = 0; i < this.Signatures.Count; i++)
            {
                if (this.Signatures[i].GetCurrentState(false) >= ButtonState.Down)
                {
                    down = true;
                    break;
                }
            }
            _current = InputUtil.GetNextButtonState(_current, down);

            if (_current == ButtonState.Down)
            {
                _lastDown = Time.realtimeSinceStartup;
            }
        }
Example #10
0
        public override void FixedUpdate()
        {
            float v = _delegate != null?_delegate() : 0f;

            switch (this.Consideration)
            {
            case AxleValueConsideration.Positive:
                //_currentFixed = InputUtil.GetNextButtonState(_currentFixed, Input.GetButton(this.UnityInputId) || Input.GetAxis(this.UnityInputId) >= this.AxisButtonDeadZone);
                _currentFixed = InputUtil.GetNextButtonState(_currentFixed, v >= this.AxisButtonDeadZone);
                break;

            case AxleValueConsideration.Negative:
                //_currentFixed = InputUtil.GetNextButtonState(_currentFixed, Input.GetButton(this.UnityInputId) || Input.GetAxis(this.UnityInputId) <= -this.AxisButtonDeadZone);
                _currentFixed = InputUtil.GetNextButtonState(_currentFixed, v <= -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, v >= this.AxisButtonDeadZone);
                break;
            }
        }
Example #11
0
        public override void Update()
        {
            base.Update();

            bool down = false;
            var  e    = this.SignaturesSet.GetEnumerator();

            while (e.MoveNext())
            {
                if (e.Current.GetCurrentState(false) >= ButtonState.Down)
                {
                    down = true;
                    break;
                }
            }
            _current = InputUtil.GetNextButtonState(_current, down);

            if (_current == ButtonState.Down)
            {
                _lastDown = Time.realtimeSinceStartup;
            }
        }
Example #12
0
 public override void FixedUpdate()
 {
     //determine based on history
     _currentFixed = InputUtil.GetNextButtonState(_currentFixed, _delegate != null ? _delegate() : false);
 }