void Start() { gunRay.position = Vector3.zero; ble = BTsocket.getBTsocket(Constants.bleMicroBit); cameraAngle = mainCamera.transform.eulerAngles.y; }
// Use this for initialization void Start() { if (BTsocket.isConnectedBLE(Constants.bleMicroBit)) { btSoc = BTsocket.getBTsocket(Constants.bleMicroBit); connectHint.text = btSoc.bleLinkData.address; disConnectedBtn.gameObject.SetActive(true); } else { linkButtonPos = -50; linkBtnFragment = 100; btSoc = BTsocket.getNewBTsocket(Constants.bleMicroBit, new BTprofile(Constants.bleMicroBit, true)); Invoke("delayScan", 2f); } //BLEStateUICtrl.addBLEstateUI(BTsocket.getBTsocket(Constants.bleMicroBit).gameObject); }
// Start is called before the first frame update void Start() { GameObject uiPanel = new GameObject("stateUIpanel"); uiPanel.transform.SetParent(BTsocket.getBTsocket(Constants.bleMicroBit).transform); uiPanel.AddComponent <RectTransform>(); Canvas panel = uiPanel.AddComponent <Canvas>(); panel.renderMode = RenderMode.ScreenSpaceOverlay; panel.sortingOrder = 15; uiPanel.AddComponent <CanvasScaler>(); GameObject stateUI = new GameObject("stateUI"); stateUI.transform.SetParent(uiPanel.transform); stateUI.AddComponent <RectTransform>(); stateUI.AddComponent <CanvasRenderer>(); state = stateUI.AddComponent <RawImage>(); state.raycastTarget = false; InvokeRepeating("scanBLEstate", 1f, 1f); }
private void OnClick() { //GameObject.Find(Constants.bleMicroBit).GetComponent<BTsocket>().connect(address); //-----測試功能----- if (!BTsocket.isConnectedBLE(Constants.bleMicroBit)) { GameObject.Find("EventSystem").GetComponent <BTManager>().connectAct(this, () => { this.GetComponentInChildren <Text>().color = Color.blue; BLEStateUICtrl.addBLEstateUI(BTsocket.getBTsocket(Constants.bleMicroBit).gameObject); }); } else { GameObject.Find("EventSystem").GetComponent <BTManager>().disConnected(); this.GetComponentInChildren <Text>().color = Color.black; } //this.GetComponentInChildren<Text>().color = Color.blue; //PlayerPrefs.SetString("preConnectMAC", address); }