Example #1
0
    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);
    }
Example #2
0
 private void OnMouseOver()
 {
     OnHovered?.Invoke(this);
     if (Input.GetMouseButtonUp(0))
     {
         if (EventSystem.current.IsPointerOverGameObject())
         {
             return;
         }
         OnClick?.Invoke(this);
     }
 }
Example #3
0
        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;
                }
            }
        }
Example #4
0
 public virtual void FireOnHovered()
 {
     OnHovered?.Invoke();
     NotifyChanged();
 }
Example #5
0
 void GainHover()
 {
     isHovered = true;
     OnHovered?.Invoke();
 }
Example #6
0
 public virtual void Hover(HandVR handVR, bool affectChildren = true)
 {
     hoverHands.Add(handVR);
     Hovered = true;
     OnHovered?.Invoke(handVR);
 }