void OnApplicationQuit() { if (urg.IsConnected) { urg.Disconnect(); } }
void Update() { if (Input.GetKeyDown("/")) { showMouse = !showMouse; } if (showMouse) { Cursor.visible = true; } else { Cursor.visible = false; } if (Input.GetKeyDown(ShowSetting)) { showGui = !showGui; } if (Enable && MainUST) { touchAreaFuct(); } if (showGui) { if (Input.GetKeyDown(KeyCode.F8)) { print("URG disconnect"); urg.Disconnect(); } if (Input.GetKeyDown(KeyCode.F7)) { print("URG connect"); urg.Connect(); } if (Input.GetKeyDown(KeyCode.F12)) { print("Default data."); Default(); } if (Input.GetKey(KeyCode.UpArrow)) { py += step; Vector3 pos = new Vector3(urg.PosOffset.x, py, urg.PosOffset.z); urg.PosOffset = pos; } if (Input.GetKey(KeyCode.DownArrow)) { py -= step; Vector3 pos = new Vector3(urg.PosOffset.x, py, urg.PosOffset.z); urg.PosOffset = pos; } if (Input.GetKey(KeyCode.LeftArrow)) { px -= step; Vector3 pos = new Vector3(px, urg.PosOffset.y, urg.PosOffset.z); urg.PosOffset = pos; } if (Input.GetKey(KeyCode.RightArrow)) { px += step; Vector3 pos = new Vector3(px, urg.PosOffset.y, urg.PosOffset.z); urg.PosOffset = pos; } if (Input.GetKey(KeyCode.Z)) { scalex -= step_scale; Vector3 pos = new Vector3(scalex, urg._Scale.y, urg._Scale.z); urg._Scale = pos; } if (Input.GetKey(KeyCode.X)) { scalex += step_scale; Vector3 pos = new Vector3(scalex, urg._Scale.y, urg._Scale.z); urg._Scale = pos; } if (Input.GetKey(KeyCode.A)) { scaley -= step_scale; Vector3 pos = new Vector3(urg._Scale.x, scaley, urg._Scale.z); urg._Scale = pos; } if (Input.GetKey(KeyCode.S)) { scaley += step_scale; Vector3 pos = new Vector3(urg._Scale.x, scaley, urg._Scale.z); urg._Scale = pos; } if (Input.GetKey(KeyCode.C)) { rot -= step_rotate * Time.deltaTime; urg.Rotate = rot; } if (Input.GetKey(KeyCode.V)) { rot += step_rotate * Time.deltaTime; urg.Rotate = rot; } if (Input.GetKeyDown("=")) { step *= 1.25f; step_scale *= 1.25f; step_rotate *= 1.25f; } if (Input.GetKeyDown("-")) { step /= 1.25f; step_scale /= 1.25f; step_rotate /= 1.25f; } if (Input.GetKeyDown(KeyCode.P)) { Debug.Log("toucharea value: " + touchArea_value); } } }