Example #1
0
        public void ProcessEvent(Event e)
        {
            if (e.type == EventType.KeyDown && e.keyCode == _keyCode && !_shortcutPressed)
            {
                _shortcutPressed = true;
                _cellBrush.Lock();

                _radiusOnStart       = _cellBrush.Radius;
                _mousePositionStartX = e.mousePosition.x + (_cellBrush.Radius * pixelToReach1Unit);
            }

            if (e.type == EventType.KeyUp && e.keyCode == _keyCode && _shortcutPressed)
            {
                _cellBrush.Unlock();
                _shortcutPressed = false;
            }

            if (_shortcutPressed)
            {
                float distance  = Mathf.Abs(e.mousePosition.x - _mousePositionStartX);
                float newRadius = (distance / pixelToReach1Unit);

                _cellBrush.Radius = newRadius;
            }
        }