private void UpdateNew(float deltaTime) { Vector2 touch = VRInput.PadTouchValue(handType); float x = touch.x; float y = touch.y; if (VRInput.GetControlDown(handType, ControlType.DPadCenter)) { OnClickMiddle?.Invoke(x, y); return; } if (VRInput.GetControlDown(handType, ControlType.DPadNorth)) { OnClickUp?.Invoke(x, y); } else if (VRInput.GetControlDown(handType, ControlType.DPadSouth)) { OnClickDown?.Invoke(x, y); } if (VRInput.GetControlDown(handType, ControlType.DPadWest)) { OnClickLeft?.Invoke(x, y); } else if (VRInput.GetControlDown(handType, ControlType.DPadEast)) { OnClickRight?.Invoke(x, y); } }
void Update() { if (Input.GetMouseButtonDown(0)) { if (OnClickDown != null) { OnClickDown.Invoke(); } } if (Input.GetKeyDown(KeyCode.Z)) { if (Input.GetKey(KeyCode.LeftShift)) { HistoryManager.Instance.Redo(); } else { HistoryManager.Instance.Undo(); } } if (Input.GetKeyUp(KeyCode.C)) { ColorManager.Instance.ToggleColorInfoMenu(); } }
public void ClickDown(InteractionData data) { if (_logInteractions) { Debug.Log(gameObject.name + " clicked down by " + data.interactingTransform.name); } _lastInteractionData = data; OnClickDown?.Invoke(data); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { OnClickDown?.Invoke(); dragDistanceBuffer.Clear(); initialMousePosition = Input.mousePosition; previousMousePosition = Input.mousePosition; } else if (Input.GetMouseButton(0)) { if (Vector3.Distance(initialMousePosition, Input.mousePosition) >= SCROLL_TOLERANCE_PX && !dragging) { OnClickAndDragBegin?.Invoke(); dragging = true; } else if (dragging) { var dragVelocity = previousMousePosition - Input.mousePosition; var currentDragVelocity = new Vector3(dragVelocity.x, 0, dragVelocity.y); OnDragGetVelocity?.Invoke(currentDragVelocity); UpdateDragBuffer(currentDragVelocity); previousMousePosition = Input.mousePosition; } } else if (Input.GetMouseButtonUp(0)) { if (dragging) { OnClickAndDragEnd?.Invoke(GetDragBufferAverage()); dragging = false; } else { OnClickAndRelease?.Invoke(); } } }
private void TouchDown(float x, float y) { OnClickDown?.Invoke(x, y); }
public void InvokeClickDown() => OnClickDown?.Invoke();