void Start() { globalscripts = GameObject.Find("GlobalScripts(Clone)").GetComponent <ClassesJSON>(); controller = GameObject.Find("Canvas").GetComponent <GameController>(); counter = 0; stopTime = false; firstTime = (int)Time.timeSinceLevelLoad; }
// Use this for initialization void Start() { globalscripts = GameObject.Find("GlobalScripts(Clone)").GetComponent <ClassesJSON>(); invokeMeteor1 = 1.1f; invokeMeteor2 = 1.3f; InvokeRepeating("SpawnMeteor1", 1.0f, 1.05f); InvokeRepeating("SpawnMeteor2", 1.0f, 1.15f); gamePaused = false; level = 1; meteorSpeed = -15; }
void Awake() { if (_instance != null) { Destroy(gameObject); } else { _instance = this; } //read class json ClassJson = JsonUtility.FromJson <ClassesJSON>(ClassJsonFile.ToString()); }
void Start() { bcolor = background.GetComponent <MeshRenderer> ().material.color; originalRed = bcolor.r; originalGreen = bcolor.g; brenderer = background.GetComponent <MeshRenderer> (); globalscripts = GameObject.Find("GlobalScripts(Clone)").GetComponent <ClassesJSON>(); firstX = globalscripts.firstX; firstY = globalscripts.firstY; firstZ = globalscripts.firstZ; controller = GameObject.Find("Canvas").GetComponent <GameController>(); rigidBody = GetComponent <Rigidbody2D> (); InvokeRepeating("Shoot", 1.0f, 0.8f); //create socket to communicate string URL = "wss://emotivcortex.com:54321"; ws = new WebSocket(URL); ws.OnMessage += new EventHandler <MessageEventArgs> (treatMessage); ws.OnOpen += (sender, e) => { Debug.Log("Connected to socket"); }; ws.OnError += (sender, e) => { Debug.Log("Error on the socket:" + e.Message); }; ws.Connect(); //creating a new session with the chosen headset if (globalscripts.currentHeadset.id != "") { ws.Send("{\"jsonrpc\": \"2.0\",\"method\": \"createSession\",\"params\": {" + "\"_auth\": \"" + globalscripts.authToken + "\", \"headset\": \"" + globalscripts.currentHeadset.id + "\", \"status\": \"open\"},\"id\": 1}"); } else { Debug.Log("Erro: o headset nao foi escolhido."); Application.Quit(); } //send message to connect to accelerometer stream ws.Send("{\"jsonrpc\": \"2.0\",\"method\": \"subscribe\",\"params\": {" + "\"_auth\": \"" + globalscripts.authToken + "\", \"streams\": [\"mot\", \"fac\", \"met\"]},\"id\": 2}"); }
// Use this for initialization void Start() { globalscripts = global.GetComponent <ClassesJSON>(); if (globalscripts != null) { globalscripts.authToken = ""; globalscripts.currentHeadset = null; globalscripts.session = null; globalscripts.headsetModel = ""; globalscripts.language = ""; globalscripts.firstX = 0f; globalscripts.firstY = 0f; globalscripts.firstZ = 0f; globalscripts.firstUpdate = false; } }
// Use this for initialization void Start() { globalscripts = GameObject.Find("GlobalScripts(Clone)").GetComponent <ClassesJSON>(); if (globalscripts.language == "en") { this.GetComponent <TextMeshProUGUI> ().text = entext; } else if (globalscripts.language == "pt") { this.GetComponent <TextMeshProUGUI> ().text = pttext; } else { this.GetComponent <TextMeshProUGUI> ().text = entext; } }
// Use this for initialization void Start() { nextBtn = GameObject.Find("Next"); connected = false; ClassesJSON globalscripts = GameObject.Find("GlobalScripts(Clone)").GetComponent <ClassesJSON>(); GameObject grid = GameObject.Find("Grid"); //adding action to onclick this.GetComponent <Button> ().onClick.AddListener(delegate { //if the headset of this button is not yet connected if (connected == false) { nextBtn.GetComponent <Image> ().color = new Color32(71, 23, 246, 255); nextBtn.GetComponent <Button>().interactable = true; //connect it by creating new session //TODO //set this headset on global globalscripts.selectHeadset(headset); this.GetComponentInChildren <TextMeshProUGUI> ().text += " --> Connected"; connected = true; //disconnect other headsets //TODO do I have to send a disconnection request ? foreach (Transform button in grid.transform) { //If it actually has this script if (button.GetComponent <ButtonClicked>() != null) { ButtonClicked bc = button.GetComponent <ButtonClicked>(); if (bc.headset.id != this.headset.id) { bc.connected = false; button.GetComponentInChildren <TextMeshProUGUI>().text = button.GetComponent <ButtonClicked>().headset.id; } } } } }); }
// Use this for initialization void Start() { globalscripts = GameObject.Find("GlobalScripts(Clone)").GetComponent <ClassesJSON>(); qualityText = GameObject.Find("Quality"); Debug.Log(globalscripts.currentHeadset.id); string URL = "wss://emotivcortex.com:54321"; ws = new WebSocket(URL); ws.OnMessage += new EventHandler <MessageEventArgs> (treatMessage); ws.OnOpen += (sender, e) => { Debug.Log("Connected to socket"); }; ws.OnError += (sender, e) => { Debug.Log("Error on the socket at Quality script:" + e.Message); }; ws.Connect(); //creating a new session with the chosen headset if (globalscripts.currentHeadset.id != "") { ws.Send("{\"jsonrpc\": \"2.0\",\"method\": \"createSession\",\"params\": {" + "\"_auth\": \"" + globalscripts.authToken + "\", \"headset\": \"" + globalscripts.currentHeadset.id + "\", \"status\": \"open\"},\"id\": 1}"); } else { Debug.Log("Erro: o headset nao foi escolhido."); Application.Quit(); } //subscribing to dev data ws.Send("{\"jsonrpc\": \"2.0\",\"method\": \"subscribe\",\"params\": {" + "\"_auth\": \"" + globalscripts.authToken + "\", \"streams\": [\"dev\"]},\"id\": 2}"); }
void Start() { globalscripts = GameObject.Find("GlobalScripts(Clone)").GetComponent <ClassesJSON>(); }