// Update is called once per frame void Update() { if (stylusSelector.GetButtonUp(1)) { print(count); switch (count) { case 0: objectToSpawn.transform.localScale = new Vector3(1, 1, 1); count++; break; case 1: objectToSpawn.transform.localScale = new Vector3(.1f, .1f, .1f); count++; break; case 2: objectToSpawn.transform.localScale = new Vector3(.5f, .5f, .5f); count = 0; break; } } else if (stylusSelector.GetButtonUp(2)) { Instantiate(objectToSpawn, stylusTip.transform.position, Quaternion.identity); } }
void checkForUserInput() { if (stylus.GetButton(0)) { if (!point0) { point0 = stylusTip.transform; location0 = stylusTip.transform.position; } else if (!point1) { point1 = stylusTip.transform; location1 = stylusTip.transform.position; } else { endPoints.transform.localScale = new Vector3(.01f, .01f, .01f); createLine(location0, location1); if (pointSwitch) { point0 = null; } else { point1 = null; } pointSwitch = !pointSwitch; } } else if (stylus.GetButtonUp(0)) { point0 = null; point1 = null; } else if (stylus.GetButtonDown(1)) { if (colorNumber + 1 < colorArray.Length) { changeColor(++colorNumber); } } else if (stylus.GetButtonDown(2)) { if (colorNumber - 1 >= 0) { changeColor(--colorNumber); } } else if (Input.GetKeyDown(KeyCode.C)) { Destroy(container.gameObject); lineCount = 0; objectCount = 0; container = new GameObject("Drawing").transform; } else if (Input.GetKeyDown(KeyCode.Z)) { Destroy(container.GetChild(container.childCount - 1).gameObject); } }
// Update is called once per frame void Update() { if (!askingQuestion) { askQuestion(); } else { if (stylus == null) { if (Input.GetMouseButtonUp(0)) { Vector3 test = Camera.main.ScreenToWorldPoint(Input.mousePosition); print(test.x); print(test.y); print(test.z); } } else { if (stylus.GetButtonUp(0)) { print("Stylus"); } } } }
// Update is called once per frame void Update() { if (stylus.GetButtonUp(1)) { if (mode < 5) { mode++; } } else if (stylus.GetButtonUp(2)) { if (mode > 0) { mode--; } } }
// Update is called once per frame void Update() { if (stylus.GetButton(1)) { rotateArm(arm2); } else if (stylus.GetButtonUp(1)) { setVisibilityOfStylus(true); } }
void Update() { bool isButtonDown = _selectButtons.Aggregate(false, (isPressed, buttonId) => isPressed |= _stylusSelector.GetButtonDown(buttonId)); if (isButtonDown) { if (_stylusSelector.HoverObject == null) { _startPosition = _stylusSelector.activeStylus.hotSpot; _startRotation = (_isAxisAligned) ? Quaternion.identity : _stylusSelector.activeStylus.transform.rotation; GetComponent <Collider>().enabled = true; GetComponent <Renderer>().enabled = true; transform.rotation = _startRotation; } } bool isButton = _selectButtons.Aggregate(false, (isPressed, buttonId) => isPressed |= _stylusSelector.GetButton(buttonId)); if (isButton && GetComponent <Renderer>().enabled) { _endPosition = _stylusSelector.activeStylus.hotSpot; Vector3 diagonal = _endPosition - _startPosition; transform.localScale = Quaternion.Inverse(transform.rotation) * diagonal; transform.position = 0.5f * (_endPosition + _startPosition); } bool isButtonUp = _selectButtons.Aggregate(false, (isPressed, buttonId) => isPressed |= _stylusSelector.GetButtonUp(buttonId)); if (isButtonUp) { GetComponent <Collider>().enabled = false; GetComponent <Renderer>().enabled = false; } }