Exemplo n.º 1
0
        private void HandleDown(InputDriver sender)
        {
            //nudge - should initiate dragging if we aren't already doing so:
            if (Status == PointerStatus.Selecting || Status == PointerStatus.Dragging)
            {
                if (!_dragging)
                {
                    StartDrag();
                }

                //pull distance in:
                _currentNudge -= _nudgeAmount;

                //clamp:
                if (_currentDistance + _currentNudge < minDistance)
                {
                    _currentNudge = minDistance - _currentDistance;
                }
            }

            if (Target != null || Status == PointerStatus.Dragging)
            {
                //interactions:
                _targetedInputReceiver?.DownReceived(gameObject);
            }
        }
Exemplo n.º 2
0
        private void HandleFire0Up(InputDriver input)
        {
            if (_draggedReceivers.Count > 0)
            {
                foreach (var item in _draggedReceivers)
                {
                    item.DragEnd(gameObject);
                }

                _draggedReceivers.Clear();
            }
            else
            {
                foreach (var item in _selectedReceivers)
                {
                    item.Clicked(gameObject);
                }
            }

            foreach (var item in _selectedReceivers)
            {
                item.Fire0UpReceived(gameObject);

                if (!_targetedReceivers.Contains(item))
                {
                    item.TargetExit(gameObject);
                }
            }

            _selectedReceivers.Clear();
        }
Exemplo n.º 3
0
 private void HandleFire2Up(InputDriver sender)
 {
     if (Target != null || Status == PointerStatus.Dragging)
     {
         //interactions:
         _targetedInputReceiver?.Fire2UpReceived(gameObject);
     }
 }
Exemplo n.º 4
0
 private void HandleRotate(float angleDelta, InputDriver sender)
 {
     if (Target != null || Status == PointerStatus.Dragging)
     {
         //interactions:
         _targetedInputReceiver?.RadialDragReceived(angleDelta, gameObject);
     }
 }
Exemplo n.º 5
0
 private void HandleDeactivate(InputDriver sender)
 {
     //hide renderers:
     foreach (var item in GetComponentsInChildren <Renderer>())
     {
         item.enabled = false;
     }
 }
Exemplo n.º 6
0
 //Event Handlers:
 private void HandleActivate(InputDriver sender)
 {
     //show renderers:
     foreach (var item in GetComponentsInChildren <Renderer>())
     {
         item.enabled = true;
     }
 }
Exemplo n.º 7
0
        //Init:
        private void Reset()
        {
            //sets:
            layermask = -1;

            //refs:
            inputDriver = GetComponent <InputDriver>();
        }
Exemplo n.º 8
0
 private void HandleFire2Up(InputDriver input)
 {
     if (_targetedReceivers.Count > 0)
     {
         foreach (var item in _targetedReceivers)
         {
             item.Fire2UpReceived(gameObject);
         }
     }
 }
Exemplo n.º 9
0
 private void HandleRotate(float delta, InputDriver input)
 {
     if (_targetedReceivers.Count > 0)
     {
         foreach (var item in _targetedReceivers)
         {
             item.RadialDragReceived(delta, gameObject);
         }
     }
 }
Exemplo n.º 10
0
        private void HandleFire0Up(InputDriver sender)
        {
            if (Target != null)
            {
                //status:
                Status = PointerStatus.Targeting;

                //interactions:
                _targetedInputReceiver?.Fire0UpReceived(gameObject);
            }

            StopDrag();
        }
Exemplo n.º 11
0
        private void HandleFire0Down(InputDriver input)
        {
            if (_targetedReceivers.Count > 0)
            {
                foreach (var item in _targetedReceivers)
                {
                    _selectedReceivers.Add(item);
                    item.Fire0DownReceived(gameObject);
                }

                _selectedPosition = inputDriver.motionSource.position;
                _selectedRotation = inputDriver.motionSource.rotation;
            }
        }
Exemplo n.º 12
0
        private void HandleFire0Down(InputDriver sender)
        {
            if (Target != null)
            {
                _lastSelection = Target;

                //status:
                Status = PointerStatus.Selecting;

                //cache where the motion source is for later delta evaluations:
                _selectedMotionSourceLocation       = inputDriver.motionSource.position;
                _selectedMotionSourceRotation       = inputDriver.motionSource.rotation;
                _selectedMotionSourceDistanceToHead = Vector3.Distance(_mainCamera.transform.position, inputDriver.motionSource.position);

                //interactions:
                _targetedInputReceiver.Fire0DownReceived(gameObject);
            }
        }