void CheckClicks() { bool shouldCancel = (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0) && currentHandle.HasValue; if (shouldCancel) { Cancel(); } if (Input.GetMouseButtonDown(0)) { if (CustomInputModule.IsPointerBlocked(30)) { return; } var pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); var interactable = CheckInteractable(pos); if (interactable != null) { if (currentHandle.HasValue) { Cancel(); } MoveTo(interactable.PlayerStandPosition, Speed, interactable.Interact); } } if (Input.GetMouseButtonDown(1)) { if (CustomInputModule.IsPointerBlocked(30)) { return; } if (currentHandle.HasValue) { Cancel(); } var pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); MoveTo(pos, Speed, null); } }
void CheckClicks() { if (Clock.Paused) { return; } bool shouldCancel = (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0) && currentHandle.HasValue; if (shouldCancel) { Cancel(); } if (!Input.GetMouseButtonDown(0) && !Input.GetMouseButtonDown(1)) { return; } Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); IInteractable interactable = CheckInteractable(pos); if (Input.GetMouseButtonDown(0)) { if (CustomInputModule.IsPointerBlocked(30)) { return; } if (interactable != null) { if (currentHandle.HasValue) { Cancel(); } currentTarget = interactable; Action action = interactable.interactionOptions.UpdateCharacterOrientation; //henrique - added the option to check if the Interface that displays options in a menu var menuOptions = interactable.gameObject.GetComponent <ImenuInteraction>(); if (menuOptions != null) { action += menuOptions.OpenMenu; } else { action += interactable.Interact; } MoveTo(interactable.interactionOptions.PlayerStandPosition, Speed, action); } } if (Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(0) && CheckInteractable(pos) == null) { if (CustomInputModule.IsPointerBlocked(30)) { return; } if (currentHandle.HasValue) { Cancel(); } if (interactable != null) { Action action = interactable.interactionOptions.UpdateCharacterOrientation; MoveTo(interactable.interactionOptions.PlayerStandPosition, Speed, action); } else { MoveTo(pos, Speed, null); } } }