public virtual void OnDrag(PointerEventData eventData)
        {
            var dragPosition = eventData.position;
            var difference   = dragPosition - StartPosition;
            var moveVector   = Vector2.Min(new Vector2(Mathf.Abs(difference.x), Mathf.Abs(difference.y)),
                                           MaxPossibleJoystickBorders) * difference.normalized;

            Transform.position = StartPosition + moveVector;
            onInteract?.Invoke(moveVector / MaxPossibleJoystickBorders);
        }
Exemplo n.º 2
0
 private void GetInteractInput()
 {
     if (Input.GetAxisRaw("Fire1") > 0)
     {
         OnInteractEvent?.Invoke();
     }
 }
Exemplo n.º 3
0
        public void Interact(Entity interactor = null)
        {
            //  Invoke an interact event
            InteractableEvent e = new InteractableEvent {
                entity = interactor, interactable = this, transform = this.transform
            };

            OnInteractEvent?.Invoke(this, e);
            if (e.cancel == true)
            {
                return;
            }                               //  return if the event has been cancelled by any subscriber
        }
Exemplo n.º 4
0
 public void Interact()
 {
     if (State == eInteractableState.ON)
     {
         OnInteractOff?.Invoke();
         State = eInteractableState.OFF;
     }
     else if (State == eInteractableState.OFF)
     {
         OnInteractOn?.Invoke();
         State = eInteractableState.ON;
     }
 }
    // Every interaction within the button collider
    public virtual void OnInteract(object from, bool activating)
    {
        if (!waitForInactive)
        {
            if (CanActivate())
            {
                if (activating)
                {
                    OnActivate(from);
                }
                else if (!highlighted)
                {
                    OnHighlight(from);
                }
            }

            else if (CanDeactivate())
            {
                if (activating)
                {
                    OnDeactivate(from);
                }
                else if (!highlighted)
                {
                    OnHighlight(from);
                }
            }
        }

        if (waitForInactive && !activating)
        {
            waitForInactive = false;
        }

        OnInteractEvent?.Invoke(this, from, activating);
    }
Exemplo n.º 6
0
 public void Interact()
 {
     OnInteract.Invoke();
 }
 public virtual void Interact(VR_Controller controller)
 {
     onInteractEvent.Invoke(controller);
 }
Exemplo n.º 8
0
 public void OnInteract()
 {
     OnInteractEvent?.Invoke();
 }
Exemplo n.º 9
0
 public void Interactinput()
 {
     OnInteractEvent?.Invoke();
 }