Exemplo n.º 1
0
 /// <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();
     }
 }
Exemplo n.º 2
0
 /// <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();
     }
 }
Exemplo n.º 3
0
 /// <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();
     }
 }
Exemplo n.º 4
0
 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;
         }
     }
 }