/// <summary> /// ask to get the state of the buttons /// </summary> public void getstateofButtonSensor() { if (getstatus == null) { getstatus = new SmartToyGetStatus(); getstatus.requestType = "get"; getstatus.components = new string[1]; getstatus.components[0] = "button"; } else { List <string> s = getstatus.components.ToList <string>(); s.Add("button"); getstatus.components = s.ToArray(); } }
/// <summary> /// ask to get the state of the Accelrometer /// </summary> public void getstateofAccelerometersensor() { if (getstatus == null) { getstatus = new SmartToyGetStatus(); getstatus.requestType = "get"; getstatus.components = new string[1]; getstatus.components[0] = "accelerometer"; } else { List <string> s = getstatus.components.ToList <string>(); s.Add("accelerometer"); getstatus.components = s.ToArray(); } }
/// <summary> /// ask to get the state of the motor controller /// </summary> public void getstateofMotorController() { if (getstatus == null) { getstatus = new SmartToyGetStatus(); getstatus.requestType = "get"; getstatus.components = new string[1]; getstatus.components[0] = "motor"; } else { List <string> s = getstatus.components.ToList <string>(); s.Add("motor"); getstatus.components = s.ToArray(); } }
void LateUpdate() { if (MagicRoomSmartToyManager.instance.MagicRoomSmartToyManager_active) { //once I reach this the whole update frame has been computed if (executecommand != null) { //send the data string json = executecommand.ToJson();//JsonUtility.ToJson(executecommand); MagicRoomSmartToyManager.instance.sendCommandExecuteSmartToy(smartToyName, json); //clean up executecommand executecommand = null; } if (getstatus != null) { //send the data string json = JsonUtility.ToJson(getstatus); MagicRoomSmartToyManager.instance.sendCommandGetStateSmartToy(smartToyName, json); //clean up executecommand getstatus = null; } } }