private void Update() { OnHovered?.Invoke(Input.mousePosition); if (Input.GetMouseButtonDown(0)) { OnLeftClic?.Invoke(Input.mousePosition); } if (Input.GetMouseButtonDown(1)) { OnRightClic?.Invoke(Input.mousePosition); } float horizontalValue = Input.GetAxisRaw("Horizontal"); OnHorizontalMove?.Invoke(horizontalValue); float verticalValue = Input.GetAxisRaw("Vertical"); OnVerticalMove?.Invoke(verticalValue); float zoomValue = Input.GetAxisRaw("Mouse ScrollWheel"); OnZoom?.Invoke(zoomValue); }
private void OnMouseOver() { OnHovered?.Invoke(this); if (Input.GetMouseButtonUp(0)) { if (EventSystem.current.IsPointerOverGameObject()) { return; } OnClick?.Invoke(this); } }
public void KillAllSubscribers() { if (OnClicked != null) { foreach (var del in OnClicked?.GetInvocationList()) { OnClicked -= (Action)del; } } if (OnHovered != null) { foreach (var del in OnHovered?.GetInvocationList()) { OnHovered -= (Action)del; } } if (OnUnhovered != null) { foreach (var del in OnUnhovered?.GetInvocationList()) { OnUnhovered -= (Action)del; } } if (OnPressed != null) { foreach (var del in OnPressed?.GetInvocationList()) { OnPressed -= (Action)del; } } if (OnReleased != null) { foreach (var del in OnReleased?.GetInvocationList()) { OnReleased -= (Action)del; } } if (OnHold != null) { foreach (var del in OnHold?.GetInvocationList()) { OnHold -= (Action)del; } } }
public virtual void FireOnHovered() { OnHovered?.Invoke(); NotifyChanged(); }
void GainHover() { isHovered = true; OnHovered?.Invoke(); }
public virtual void Hover(HandVR handVR, bool affectChildren = true) { hoverHands.Add(handVR); Hovered = true; OnHovered?.Invoke(handVR); }