Exemplo n.º 1
0
        void DoKnobUpdate(float inputValue)
        {
            const float threshold = 0.5f;

            if (_isRelative)
            {
                float relValue = (inputValue < 0.5f) ? 1 : -1;
                _valueEvent.Invoke(relValue / 127);
            }
            else
            {
                // Update the target value for the interpolator.
                _floatValue.targetValue = _responseCurve.Evaluate(inputValue);

                // Invoke the event in direct mode.
                if (!_interpolator.enabled)
                {
                    _valueEvent.Invoke(_floatValue.Step());
                }
            }

            // Detect an on-event and invoke the event.
            if (_lastInputValue < threshold && inputValue >= threshold)
            {
                _onEvent.Invoke();
            }

            // Detect an off-event and invoke the event.
            if (inputValue < threshold && _lastInputValue >= threshold)
            {
                _offEvent.Invoke();
            }

            _lastInputValue = inputValue;
        }
Exemplo n.º 2
0
 void Update()
 {
     if (_interpolator.enabled)
     {
         _outputEvent.Invoke(_floatValue.Step());
     }
 }
Exemplo n.º 3
0
 void Update()
 {
     if (_interpolator.enabled)
     {
         InvokeValueEvent(_value.Step());
     }
 }
 protected override void UpdateState()
 {
     if (_interpolator.enabled)
     {
         _outputEvent.Invoke(Quaternion.Euler(_floatValueX.Step(_resultValue.x), _floatValueY.Step(_resultValue.y), _floatValueZ.Step(_resultValue.z)));
     }
 }
Exemplo n.º 5
0
 void Update()
 {
     if (_interpolator.enabled && _initialized)
     {
         _valueEvent.Invoke(_outputValue.Step());
     }
 }
Exemplo n.º 6
0
 protected override void UpdateState()
 {
     if (_interpolator.enabled)
     {
         _outputEvent.Invoke(_floatValue.Step());
     }
 }
Exemplo n.º 7
0
        void Update()
        {
            // invoke events in the queue
            lock (_eventQueue)
                while (_eventQueue.Count > 0)
                {
                    switch (_eventQueue.Dequeue())
                    {
                    case EventRecord.Trigger: _triggerEvent.Invoke(); break;

                    case EventRecord.GateOn:  _gateOnEvent.Invoke(); break;

                    case EventRecord.GateOff: _gateOffEvent.Invoke(); break;
                    }
                }

            // value interpolation and invokation
            if (_eventType == EventType.Value)
            {
                _valueEvent.Invoke(_value.Step());
            }

            #if UNITY_EDITOR
            // re-register the osc data callback if the address was changed
            if (_address != _registeredAddress)
            {
                OnDisable();
                OnEnable();
            }
            #endif
        }
Exemplo n.º 8
0
        void Update()
        {
            // Invoke events in the queue.
            lock (_eventQueue)
                while (_eventQueue.Count > 0)
                {
                    switch (_eventQueue.Dequeue())
                    {
                    case EventRecord.Bang: _bangEvent.Invoke(); break;

                    case EventRecord.On:   _onEvent.Invoke(); break;

                    case EventRecord.Off:  _offEvent.Invoke(); break;
                    }
                }

            // Value interpolation and invokation.
            _valueEvent.Invoke(_value.Step());

            #if UNITY_EDITOR
            // Re-register the osc data callback if the address was changed.
            if (_address != _registeredAddress)
            {
                OnDisable();
                OnEnable();
            }
            #endif
        }
Exemplo n.º 9
0
 void Update()
 {
     if (_eventType == EventType.Value)
     {
         _valueEvent.Invoke(_value.Step());
     }
 }
Exemplo n.º 10
0
 void Update()
 {
     if (_eventType == EventType.Value)
     {
         _value.targetValue = _stateValues[_state];
         _valueEvent.Invoke(_value.Step());
     }
 }
Exemplo n.º 11
0
        void Update()
        {
            switch (_timeType)
            {
            case TimeType.DeltaTime:
                _timeValue.targetValue = Time.deltaTime;
                break;

            case TimeType.Time:
                _timeValue.targetValue = Time.time;
                break;

            case TimeType.FixedDeltaTime:
                _timeValue.targetValue = Time.fixedDeltaTime;
                break;

            case TimeType.CaptureFramerate:
                _timeValue.targetValue = Time.captureFramerate;
                break;

            case TimeType.FixedTime:
                _timeValue.targetValue = Time.fixedTime;
                break;

            case TimeType.FrameCount:
                _timeValue.targetValue = Time.frameCount;
                break;

            case TimeType.MaximumDeltaTime:
                _timeValue.targetValue = Time.maximumDeltaTime;
                break;

            case TimeType.RealtimeSinceStartup:
                _timeValue.targetValue = Time.realtimeSinceStartup;
                break;

            case TimeType.RenderedFramecount:
                _timeValue.targetValue = Time.renderedFrameCount;
                break;

            case TimeType.SmoothDeltaTime:
                _timeValue.targetValue = Time.smoothDeltaTime;
                break;

            case TimeType.TimeSinceLevelLoad:
                _timeValue.targetValue = Time.timeSinceLevelLoad;
                break;

            case TimeType.UnscaledDeltaTime:
                _timeValue.targetValue = Time.unscaledDeltaTime;
                break;

            case TimeType.UnscaledTime:
                _timeValue.targetValue = Time.unscaledTime;
                break;
            }
            _valueEvent.Invoke(_timeValue.Step());
        }
Exemplo n.º 12
0
        void Update()
        {
            if (_source != _prevSource)
            {
                SwitchSource();
            }

            _valueEvent.Invoke(_floatValue.Step());
        }
        void Update()
        {
            var pos = Input.mousePosition;

            _xValue.targetValue = pos.x / Screen.width;
            _yValue.targetValue = pos.y / Screen.height;

            _xEvent.Invoke(_xValue.Step());
            _yEvent.Invoke(_yValue.Step());
        }
Exemplo n.º 14
0
        void DoKnobUpdate(float inputValue)
        {
            const float threshold = 0.5f;

            if (_eventType == EventType.Value)
            {
                // update the target value for the interpolator
                _value.targetValue =
                    BasicMath.Lerp(_outputValue0, _outputValue1, inputValue);
                // invoke the event in direct mode
                if (!_interpolator.enabled)
                {
                    _valueEvent.Invoke(_value.Step());
                }
            }
            else if (_lastInputValue < threshold && inputValue >= threshold)
            {
                if (_eventType == EventType.Trigger)
                {
                    _triggerEvent.Invoke();
                }
                else // EventType.Toggle
                {
                    _toggleState ^= true;
                    if (_toggleState)
                    {
                        _toggleOnEvent.Invoke();
                    }
                    else
                    {
                        _toggleOffEvent.Invoke();
                    }
                }
            }

            _lastInputValue = inputValue;
        }
Exemplo n.º 15
0
        void Update()
        {
            if (_eventType == EventType.Trigger)
            {
                if (IsKeyDown)
                {
                    _triggerEvent.Invoke();
                }
            }
            else if (_eventType == EventType.Gate)
            {
                if (IsKeyDown)
                {
                    _keyDownEvent.Invoke();
                }
                else if (IsKeyUp)
                {
                    _keyUpEvent.Invoke();
                }
            }
            else if (_eventType == EventType.Toggle)
            {
                if (IsKeyDown)
                {
                    _toggle ^= true;
                    if (_toggle)
                    {
                        _toggleOnEvent.Invoke();
                    }
                    else
                    {
                        _toggleOffEvent.Invoke();
                    }
                }
            }
            else // EventType.Value
            {
                if (IsKeyDown)
                {
                    _value.targetValue = _onValue;
                }
                else if (IsKeyUp)
                {
                    _value.targetValue = _offValue;
                }

                _valueEvent.Invoke(_value.Step());
            }
        }
Exemplo n.º 16
0
        protected override void UpdateState()
        {
            if (Input.GetButtonDown(_buttonName))
            {
                _buttonDownEvent.Invoke();
                _floatValue.targetValue = _onValue;
            }
            else if (Input.GetButtonUp(_buttonName))
            {
                _buttonUpEvent.Invoke();
                _floatValue.targetValue = _offValue;
            }

            _valueEvent.Invoke(_floatValue.Step());
        }
Exemplo n.º 17
0
        void Update()
        {
            if (IsKeyDown)
            {
                _keyDownEvent.Invoke();
                _floatValue.targetValue = _onValue;
            }
            else if (IsKeyUp)
            {
                _keyUpEvent.Invoke();
                _floatValue.targetValue = _offValue;
            }

            _valueEvent.Invoke(_floatValue.Step());
        }
Exemplo n.º 18
0
        void Update()
        {
            if (Input.GetKeyDown(_keyCode))
            {
                _keyDownEvent.Invoke();
                _floatValue.targetValue = _onValue;
            }
            else if (Input.GetKeyUp(_keyCode))
            {
                _keyUpEvent.Invoke();
                _floatValue.targetValue = _offValue;
            }

            _valueEvent.Invoke(_floatValue.Step());
        }
Exemplo n.º 19
0
        void Update()
        {
            if (Input.GetMouseButtonDown(_buttonIndex))
            {
                _buttonDownEvent.Invoke();
                _floatValue.targetValue = _onValue;
            }
            else if (Input.GetMouseButtonUp(_buttonIndex))
            {
                _buttonUpEvent.Invoke();
                _floatValue.targetValue = _offValue;
            }

            _valueEvent.Invoke(_floatValue.Step());
        }
        protected override void UpdateState()
        {
            var pos = Input.mousePosition;

            if (_normalized)
            {
                _xValue.targetValue = pos.x / Screen.width;
                _yValue.targetValue = pos.y / Screen.height;
            }
            else
            {
                _xValue.targetValue = pos.x;
                _yValue.targetValue = pos.y;
            }

            _xEvent.Invoke(_xValue.Step());
            _yEvent.Invoke(_yValue.Step());
        }
Exemplo n.º 21
0
        protected override void UpdateState()
        {
            if (Input.GetKeyDown(_keyCode))
            {
                _keyDownEvent.Invoke();
                _floatValue.targetValue = _onValue;
                _pressed = true;
            }
            else if (Input.GetKeyUp(_keyCode))
            {
                _keyUpEvent.Invoke();
                _floatValue.targetValue = _offValue;
                _pressed = false;
            }

            _stateEvent.Invoke(_pressed);
            _valueEvent.Invoke(_floatValue.Step());
        }
Exemplo n.º 22
0
 void Update()
 {
     _valueEvent.Invoke(_value.Step());
 }
Exemplo n.º 23
0
 void Update()
 {
     _axisValue.targetValue = Input.GetAxis(_axisName);
     _valueEvent.Invoke(_axisValue.Step());
 }
Exemplo n.º 24
0
 protected override void UpdateState()
 {
     _valueEvent.Invoke(_value.Step());
     _stateEvent.Invoke(_state);
 }
Exemplo n.º 25
0
 protected override void UpdateState()
 {
     _axisValue.targetValue  = Input.GetAxis(_axisName);
     _valueEvent.Invoke(_val = _axisValue.Step());
 }
Exemplo n.º 26
0
 void Update()
 {
     _outputValue.targetValue = _floatValue;
     _valueEvent.Invoke(_outputValue.Step());
 }