//Other Functions void checkActionTile(int index) { //If your tap is over top a UI element, don't click the tile below it if (IT_Utility.IsCursorOnUI(inputPos)) { Debug.Log("on UI"); return; } tileTag = hexa.GetTileTagInt(index); tileClicked = index; clickedTilePos = hexa.GetTileCenter(index); //If your tap is over top a grass tile (tileTag == 2), move menu and know that it's a grass tile if (tileTag == 2) { moveMenuNow(); Debug.Log("on Grass"); return; } else { //Debug.Log(clickedTilePos); moveMenuNow(); //sendMoveToRobots(tileClicked); } }
//If you click into space, disable the menu //Uses IT_Gesture.onShortTapE event to trigger function call void toggleMenuActiveOnNull(Vector2 position) { if (IT_Utility.GetHovered3DObject(position, Camera.main) == null) { selfCanvas.enabled = false; } }
//Checks for objects at the screen position that was tapped, reference it for use void checkForGameobject(Vector2 position) { inputPos = position; if (IT_Utility.GetHovered3DObject(position, Camera.main) != null) { GameObject foundObject = IT_Utility.GetHovered3DObject(position, Camera.main); } }
public IEnumerator checkMouseCursor() { while (adjustMenuScript.selfCanvas.enabled == true) { // RaycastHit hit; // Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); GameObject testingUI = IT_Utility.GetHoveredUIElement(Input.mousePosition); // if (Physics.Raycast(ray, out hit)) { // Transform objectHit = hit.transform; // Debug.Log(objectHit); // } if (testingUI) { Debug.Log(testingUI); } yield return(new WaitForSeconds(0.1f)); } }
void OnMultiTap(Tap tap) { bool objDetected = false; //check if the tap has landed on any UIElement if (IT_Utility.IsCursorOnUI(tap.pos)) { //get the UIElement gameobject the tap landed on GameObject objUI = IT_Utility.GetHoveredUIElement(tap.pos); Debug.Log("Cursor has landed on an UI element (" + objUI.name + ")"); objDetected = true; } //get the 2D sprite gameobject (uses 2DCollider) the tap landed on GameObject obj2D = IT_Utility.GetHovered2DObject(tap.pos); if (obj2D != null) { Debug.Log("Cursor has landed on a 2D object (" + obj2D.name + ")"); objDetected = true; } //get the 3D gameobject (uses default collider) the tap landed on GameObject obj3D = IT_Utility.GetHovered3DObject(tap.pos); if (obj3D != null) { Debug.Log("Cursor has landed on a 3D object (" + obj3D.name + ")"); objDetected = true; } if (!objDetected) { Debug.Log("Cusror has landed on nothing"); } }