void Update() { if (transform.localPosition.x > 3 || transform.localPosition.y > 3 || transform.localPosition.z > 3 || transform.localPosition.x < -3 || transform.localPosition.y < -3 || transform.localPosition.z < -3) { transform.localPosition = Vector3.up; } var position = new Vector3(transform.position.x - 7.829586f, transform.position.y - 0.9757428f, transform.position.z + 3.546846f); //var position = transform.parent.localPosition; target.localPosition = new Vector3(position.x * 3 * 1.7f, position.y * 1.7f, -position.z * 3 * 1.7f); target.localEulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z); handIndicator = MyInputManager.InRange(transform.position, 0.5f); if (handIndicator != '0') { if (!isGrabbed) { outline.enabled = true; } if (MyInputManager.GripValue(handIndicator) > 0 && !isGrabbed) { isGrabbed = true; outline.enabled = false; } if (MyInputManager.GripValue(handIndicator) > 0 && !isGrabbed) { isGrabbed = true; outline.enabled = false; } MoveClaws(MyInputManager.TriggerValue(handIndicator)); if (isGrabbed && MyInputManager.GripValue(handIndicator) <= 0) { isGrabbed = false; } } }
private void Update() { if (!DeviceLeft.isValid) { GetLeftDevice(); } if (!DeviceRight.isValid) { GetRightDevice(); } #if UNITY_ANDROID //Debug.Log("on android platform"); #endif #if !UNITY_ANDROID //Debug.Log("not on Android Platform"); #endif if (MyInputManager.GripValue('l') > 0) { for (int i = 0; i < leftDescriptions.Length; i++) { leftDescriptions[i].enabled = true; } for (int i = 0; i < rightDescriptions.Length; i++) { rightDescriptions[i].enabled = true; } } else { for (int i = 0; i < leftDescriptions.Length; i++) { leftDescriptions[i].enabled = false; } for (int i = 0; i < rightDescriptions.Length; i++) { rightDescriptions[i].enabled = false; } } }
void Update() { prim2DAxis = MyInputManager.Primary2DAxis('r'); if (!grabbed && Vector3.Distance(transform.position, MyInputManager.rightHandController.position) < grabbingDistance) { outline.enabled = true; if (MyInputManager.TriggerValue('r') > 0.5f) { outline.enabled = false; grabbed = true; foreach (var mr in MyInputManager.rightHandController.GetComponentsInChildren <MeshRenderer>()) { mr.enabled = false; } enableDescriptionTextsFor(5); transform.parent = MyInputManager.rightHandController.parent; transform.rotation = MyInputManager.rightHandController.rotation; transform.position = MyInputManager.rightHandController.position; currHandIndicator = 'r'; } } else { outline.enabled = false; } if (grabbed) { if (prim2DAxis.x < 0.3 && prim2DAxis.y < 0.3 && prim2DAxis.x > -0.3 && prim2DAxis.y > -0.3 && MyInputManager.Primary2DAxisClick('r')) { transform.parent = oldParent; transform.rotation = oldRotation; transform.position = oldPosition; if (currHandIndicator == 'r') { foreach (var mr in MyInputManager.rightHandController.GetComponentsInChildren <MeshRenderer>()) { mr.enabled = true; } } grabbed = false; //outline.enabled = false; } } if (!enableDescriptionTexts) { if (MyInputManager.GripValue('r') > 0) { foreach (var meshRenderer in descriptionTexts.GetComponentsInChildren <MeshRenderer>()) { meshRenderer.enabled = true; } } else { foreach (var meshRenderer in descriptionTexts.GetComponentsInChildren <MeshRenderer>()) { meshRenderer.enabled = false; } } } }