Exemplo n.º 1
0
 public void Consume()
 {
     if (GameLoop.CurrentSequence == UpdateSequence.FixedUpdate)
     {
         _currentFixed = InputUtil.ConsumeButtonState(_currentFixed);
     }
     else
     {
         _current = InputUtil.ConsumeButtonState(_current);
     }
 }
        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;
            }
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 5
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;
            }
        }
Exemplo n.º 7
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;
            }
        }
Exemplo n.º 8
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;
            }
        }
Exemplo n.º 9
0
 public override void FixedUpdate()
 {
     //determine based on history
     _currentFixed = InputUtil.GetNextButtonState(_currentFixed, _delegate != null ? _delegate() : false);
 }
 public override void FixedUpdate()
 {
     _currentFixed = InputUtil.GetNextFixedButtonStateFromCurrent(_currentFixed, _current);
 }