private void ProcessTouch() { if (Input.touchCount == 0) { return; } foreach (Touch touch in Input.touches) { if (touch.phase == TouchPhase.Began) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(touch.position); previousRay = ray; // Get shonky and show inspector if we hit a shony, otherwise hide it. if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { Shonky shonky = hit.transform.GetComponent <Shonky>(); if (shonky != null) { ShowInspectionMenu(shonky); } } else { HideInspectionMenu(); } } } }
private void ProcessMouse() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); previousRay = ray; // Get shonky and show inspector if we hit a shony, otherwise hide it. if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { Shonky shonky = hit.transform.GetComponent <Shonky>(); if (shonky != null) { ShowInspectionMenu(shonky); } } else { HideInspectionMenu(); } } }
private void ShowInspectionMenu(Shonky shonky) { inspectionPanel.SetActive(true); //textHeading.text = shonky.ItemName(); //textInfo.text = shonky.ItemInfo(); }