void OnMouseDown() { if (MobileEvents.OnMobileUse != null) { MobileEvents.OnMobileUse(); } }
void OnMouseUp() { if (MobileEvents.OnMobileUseUp != null) { MobileEvents.OnMobileUseUp(); } }
public void CloseInventory() { if (MobileEvents.OnMobileInventoryWantsClosed != null) { MobileEvents.OnMobileInventoryWantsClosed(); } }
public void OpenInventory() { if (MobileEvents.OnMobileInventory != null) { MobileEvents.OnMobileInventory(); } }
public void OnPointerUp(PointerEventData eventData) { if (MobileEvents.OnMobileUseUp != null) { MobileEvents.OnMobileUseUp(); } }
public void OnPointerDown(PointerEventData eventData) { if (MobileEvents.OnMobileUse != null) { MobileEvents.OnMobileUse(); } }
public void CloseInventory() { if (spawnRoutine != null) { StopCoroutine(spawnRoutine); } spawnRoutine = SpawnItems(false); StartCoroutine(spawnRoutine); if (MobileEvents.OnMobileInventoryClosed != null) { MobileEvents.OnMobileInventoryClosed(); } }
public void OnDrag(PointerEventData eventData) { Vector2 pos; if (RectTransformUtility.ScreenPointToLocalPointInRectangle(JoystickBackground.rectTransform, eventData.position, eventData.pressEventCamera, out pos)) { //Recalculate to local space pos.x /= JoystickBackground.rectTransform.sizeDelta.x; pos.y /= JoystickBackground.rectTransform.sizeDelta.y; inputVector = pos; float inputLength = inputVector.magnitude; if (inputLength > 1) { inputVector.Normalize(); } if (inputLength >= 0.98f) { if (MobileEvents.OnMobileSprintDown != null) { MobileEvents.OnMobileSprintDown(); } sentSprint = true; } else { if (sentSprint) { if (MobileEvents.OnMobileSprintUp != null) { MobileEvents.OnMobileSprintUp(); } sentSprint = false; } } //Move handle image JoystickHandle.rectTransform.position = JoystickBackground.rectTransform.position + new Vector3(JoystickBackground.rectTransform.sizeDelta.x * inputVector.x, JoystickBackground.rectTransform.sizeDelta.y * inputVector.y, 0); } }
public void OnPointerUp(PointerEventData eventData) { ray = mainCam.ScreenPointToRay(eventData.position); if (Physics.RaycastNonAlloc(ray, hits, 10f, interactionLayers, QueryTriggerInteraction.Collide) > 0) { for (int i = 0; i < hits.Length; i++) { if (hits[i].transform != null) { if (potentialInteractions.Contains(hits[i].transform)) { GameManager.InteractWithObject(hits[i].transform.gameObject); } } } } if (MobileEvents.OnMobileUseUp != null) { MobileEvents.OnMobileUseUp(); } }