public void ProcessTouchPadDown() { if (!currentObject) { return; } Interacable interacable = currentObject.GetComponent <Interacable>(); interacable.Pressed(); }
private void processUI(GameObject obj) { if (currentObject != null) { if (obj == currentObject) { return; } clearSelectionUI(); } currentObject = obj; Interacable inter = currentObject.GetComponent <Interacable>(); inter.increase(); }
void Interact() { // If right mous button is pressed, cast ray, detect interacables and interact if (Input.GetMouseButton(1)) { Ray ray = mainCam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100)) { Interacable interacable = hit.collider.GetComponent <Interacable>(); if (interacable != null) { SceneManager.LoadScene(3); } } } }