void DeleteGameObject() { ObjectPropertySet activeObject = InputManager.Instance.activeGameObject; Destroy(activeObject.gameObject); GetComponent <AudioSource>().Play(); deleteButton.interactable = false; }
//TODO button text colour change private void Update() { ObjectPropertySet activeObject = InputManager.Instance.activeGameObject; if (activeObject == null) { deleteButton.interactable = false; } else { deleteButton.interactable = true; } }
//TODO texture button text colour change. void TextureButtonActive() { ObjectPropertySet activeObj = activeGameObject; if (canPlaceObject) { MenuManager.Instance.textureChangeButton.interactable = false; } else { if (activeObj.texSet != TextureSet.NONE) { MenuManager.Instance.textureChangeButton.interactable = true; } else { MenuManager.Instance.textureChangeButton.interactable = false; } } }
void Update() { if (editPanelOn) { CrosshairCalculation(); crosshair.SetActive(canPlaceObject); TextureButtonActive(); if (Input.touchCount == 0) { moveTouch = false; if (!viewModePanelOn) { canGrabObject = true; } return; } touch = Input.GetTouch(0); if (IsPointerOverUI(touch)) { return; } // On one finger touch //************************** if (Input.touchCount == 1) { if (IsPointerOverUI(touch)) { return; } moveTouch = true; if (Input.GetTouch(0).phase == TouchPhase.Began && canPlaceObject) { ObjectPropertySet copy = Instantiate(selectedGameObject, crosshair.transform.position, crosshair.transform.rotation); GetComponent <AudioSource>().Play(); focusObjectPlaced = true; } } // On two finger touch //************************* if (Input.touchCount == 2) { if (IsPointerOverUI(touch)) { return; } Ray ray = arCam.ScreenPointToRay(touch.position); if (raycastManager.Raycast(ray, hits)) { pose = hits[0].pose; Vector3 magnitude = pose.position - activeGameObject.transform.position; Vector3 direction = magnitude.normalized; float angle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg; angle += 180; if (Input.GetTouch(1).phase == TouchPhase.Began) // at the beginning of the gesture { oldRotationAngle = angle; // there is no "jump" in the rotation } float deltaAngle = angle - oldRotationAngle; Vector3 rotEuler = activeGameObject.transform.localEulerAngles; rotEuler.y += deltaAngle; activeGameObject.transform.localEulerAngles = rotEuler; oldRotationAngle = angle; } } } }