void Update() { outputPin1.setState(PinState.Low); outputPin2.setState(PinState.Low); outputPin5.setState(PinState.Low); outputPin6.setState(PinState.Low); float moveSpeed = 3f; float turnSpeed = 100f; if (Input.GetKey(KeyCode.UpArrow)) { outputPin2.setState(PinState.High); //outputPin6.setState(PinState.High); obj.transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime); } if (Input.GetKey(KeyCode.DownArrow)) { outputPin1.setState(PinState.High); //outputPin5.setState(PinState.High); obj.transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime); } if (Input.GetKey(KeyCode.LeftArrow)) { outputPin2.setState(PinState.High); //outputPin5.setState(PinState.High); obj.transform.Rotate(Vector3.up * -turnSpeed * Time.deltaTime); } if (Input.GetKey(KeyCode.RightArrow)) { outputPin1.setState(PinState.High); //outputPin6.setState(PinState.High); obj.transform.Rotate(Vector3.up * turnSpeed * Time.deltaTime); } }
/*private void Init() * { * if (Network == null) * { * Debug.LogError("Network is null"); * return; * } * * * * * if (_library == null) * { * Debug.LogError("Failed to create hardware extension interface library"); * return; * } * }*/ public Example() { Console.WriteLine("Example hi"); _adnLibrary = Antilatency.DeviceNetwork.Library.load(); _library = Antilatency.HardwareExtensionInterface.Library.load(); _nodeHandle = WaitForNode(); _cotaskConstructor = _library.getCotaskConstructor(); _deviceNetwork = _adnLibrary.createNetwork(new[] { new UsbDeviceType { vid = UsbVendorId.Antilatency, pid = 0x0000 } }); _cotask = _cotaskConstructor.startTask(_deviceNetwork, _nodeHandle); outputPin1 = _cotask.createOutputPin(Pins.IO1, PinState.Low); outputPin2 = _cotask.createOutputPin(Pins.IO2, PinState.Low); outputPin5 = _cotask.createOutputPin(Pins.IO5, PinState.Low); outputPin6 = _cotask.createOutputPin(Pins.IO6, PinState.Low); _cotask.run(); Update(); void Update() { if (Input.GetKey(KeyCode.UpArrow)) { outputPin2.setState(PinState.High); outputPin6.setState(PinState.High); } if (Input.GetKey(KeyCode.DownArrow)) { outputPin1.setState(PinState.High); outputPin5.setState(PinState.High); } if (Input.GetKey(KeyCode.LeftArrow)) { outputPin2.setState(PinState.High); outputPin5.setState(PinState.High); } if (Input.GetKey(KeyCode.RightArrow)) { outputPin6.setState(PinState.High); outputPin1.setState(PinState.High); } } }