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); }
private void GetInteractInput() { if (Input.GetAxisRaw("Fire1") > 0) { OnInteractEvent?.Invoke(); } }
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 }
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); }
public void Interact() { OnInteract.Invoke(); }
public virtual void Interact(VR_Controller controller) { onInteractEvent.Invoke(controller); }
public void OnInteract() { OnInteractEvent?.Invoke(); }
public void Interactinput() { OnInteractEvent?.Invoke(); }