示例#1
0
    void Update()
    {
        if ((int)Time.time % 2 == 0)
        {
            positiveCount++;
            if (positiveCount >= 31)
            {
                //FollowSerial.sendAllProtocol(pollice,mignolo,medio,indice,anuce,0);


                // indice = anulare
                // medio = indice
                // anulare = miglolo
                // mignolo = pollice
                // pollice = medio


                FollowSerial.sendAllProtocol(medio, pollice, indice, anuce, mignolo, 0);

                polliceGUI.text = pollice.ToString();
                indiceGUI.text  = indice.ToString();
                medioGUI.text   = medio.ToString();
                anuceGUI.text   = anuce.ToString();
                mignoloGUI.text = mignolo.ToString();


                Debug.Log("Indice: " + indice + " Medio: " + medio + " Anuce: " + anuce + " Mignolo: " + mignolo + " Pollice: " + pollice);
                //Debug.Log("Count Positive:" + positiveCount);
                positiveCount = 0;
            }
        }
        else
        {
            negativeCount++;
            if (negativeCount >= 31)
            {
                //FollowSerial.sendAllProtocol(pollice,mignolo,medio,indice,anuce,0);

                FollowSerial.sendAllProtocol(medio, pollice, indice, anuce, mignolo, 0);


                polliceGUI.text = pollice.ToString();
                indiceGUI.text  = indice.ToString();
                medioGUI.text   = medio.ToString();
                anuceGUI.text   = anuce.ToString();
                mignoloGUI.text = mignolo.ToString();

                Debug.Log("Indice: " + indice + " Medio: " + medio + " Anuce: " + anuce + " Mignolo: " + mignolo + " Pollice: " + pollice);
                //Debug.Log("Count Negative:" + negativeCount);
                negativeCount = 0;
            }
        }
    }
示例#2
0
    void Update()
    {
        if ((int)Time.time % 2 == 0)
        {
/************************
* Positive values Time *
************************/

            pollice += (int)VanquishMasterLeap.followValues[4];
            indice  += (int)VanquishMasterLeap.followValues[2];
            medio   += (int)VanquishMasterLeap.followValues[0];
            anuce   += (int)VanquishMasterLeap.followValues[1];
            mignolo += (int)VanquishMasterLeap.followValues[3];

            count++;
//			Debug.Log("Pollice: "+VanquishMasterLeap.followValues[4]+" Indice: "+VanquishMasterLeap.followValues[2]+" Medio: "+VanquishMasterLeap.followValues[0]+" Anulare: "+VanquishMasterLeap.followValues[1]+" Mignolo: "+VanquishMasterLeap.followValues[3]+" Mano: "+VanquishMasterLeap.posizioneMano+" Time: " + Time.time);

/************************
 * Negative values Time *
 ***********************/

            if (NegativePollice > 0 && NegativeIndice > 0 && NegativeMedio > 0 && NegativeAnuce > 0 && NegativeMignolo > 0 && NegativeCount > 0)
            {
                NegativePollice /= NegativeCount;
                NegativeIndice  /= NegativeCount;
                NegativeMedio   /= NegativeCount;
                NegativeAnuce   /= NegativeCount;
                NegativeMignolo /= NegativeCount;

                Debug.Log("PolliceNegative: " + NegativePollice + "  IndiceNegative: " + NegativeIndice + "  MedioNegative: " + NegativeMedio + "  AnulareNegative: " + NegativeAnuce + "  MignoloNegative: " + NegativeMignolo);
                FollowSerial.sendAllProtocol(NegativeIndice, NegativeMedio, NegativeAnuce, NegativeMignolo, NegativePollice, 0);

                polliceGUI.text = "Pollice " + pollice;
                indiceGUI.text  = "Indice " + indice;
                medioGUI.text   = "Medio " + medio;
                anuceGUI.text   = "Anulare " + anuce;
                mignoloGUI.text = "Mignolo " + mignolo;
                manoGUI.text    = "Mano";
            }

            NegativePollice = 0;
            NegativeIndice  = 0;
            NegativeMedio   = 0;
            NegativeAnuce   = 0;
            NegativeMignolo = 0;

            NegativeCount = 0;
        }
        else
        {
/************************
* Negative values Time *
************************/

            NegativePollice += (int)VanquishMasterLeap.followValues[4];
            NegativeIndice  += (int)VanquishMasterLeap.followValues[2];
            NegativeMedio   += (int)VanquishMasterLeap.followValues[0];
            NegativeAnuce   += (int)VanquishMasterLeap.followValues[1];
            NegativeMignolo += (int)VanquishMasterLeap.followValues[3];

            NegativeCount++;

/************************
* Positive values Time *
************************/

            if (pollice > 0 && indice > 0 && medio > 0 && anuce > 0 && mignolo > 0 && count > 0)
            {
                pollice /= count;
                indice  /= count;
                medio   /= count;
                anuce   /= count;
                mignolo /= count;

                Debug.Log("Pollice: " + pollice + "  Indice: " + indice + "  Medio: " + medio + "  Anulare: " + anuce + "  Mignolo: " + mignolo);
//			    FollowSerial.sendAllProtocol(indice,medio,anuce,mignolo,pollice,0);

                polliceGUI.text = "Pollice " + pollice;
                indiceGUI.text  = "Indice " + indice;
                medioGUI.text   = "Medio " + medio;
                anuceGUI.text   = "Anulare " + anuce;
                mignoloGUI.text = "Mignolo " + mignolo;
                manoGUI.text    = "Mano";
            }

            pollice = 0;
            indice  = 0;
            medio   = 0;
            anuce   = 0;
            mignolo = 0;

            count = 0;
        }
    }
示例#3
0
 void Start()
 {
     FollowSerial.sendAllProtocol(0, 0, 0, 0, 0, 0);
 }
示例#4
0
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit))
            {
                switch (hit.collider.name)
                {
                case "PolliceON":

                    send[4] = 90;
                    Debug.Log("PolliceON");

                    break;

                case "PolliceOFF":

                    send[4] = 0;
                    Debug.Log("PolliceOFF");

                    break;

                case "IndiceON":

                    send[0] = 90;
                    Debug.Log("IndiceON");

                    break;

                case "IndiceOFF":

                    send[0] = 0;
                    Debug.Log("IndiceOFF");

                    break;

                case "MedioON":

                    send[1] = 90;
                    Debug.Log("MedioON");

                    break;

                case "MedioOFF":

                    send[1] = 0;
                    Debug.Log("MedioOFF");

                    break;

                case "AnulareON":

                    send[2] = 90;
                    Debug.Log("AnuceON");

                    break;

                case "AnulareOFF":

                    send[2] = 0;
                    Debug.Log("AnuceOFF");

                    break;

                case "MignoloON":

                    send[3] = 90;
                    Debug.Log("MignoloON");

                    break;

                case "MignoloOFF":

                    send[3] = 0;
                    Debug.Log("MignoloOFF");

                    break;

                case "ManoON":

                    send[5] = 90;
                    Debug.Log("ManoON");

                    break;

                case "ManoOFF":

                    send[5] = 0;
                    Debug.Log("ManoOFF");

                    break;

                case "reset":

                    FollowSerial.sendAllProtocol(0, 0, 0, 0, 0, 0);
                    for (int i = 0; i < 5; i++)
                    {
                        send[i] = 0;
                    }

                    break;

                case "HandClose":

                    //  FollowSerial.sendAllProtocol(90,90,90,90,0,0);
                    //	FollowSerial.sendAllProtocol(send[0],send[1],send[2],send[3],send[4],send[5]);
                    for (int i = 0; i < 4; i++)
                    {
                        send[i] = 90;
                    }
                    FollowSerial.sendAllProtocol(send[0], send[1], send[2], send[3], send[4], send[5]);
                    break;
                }

                FollowSerial.sendAllProtocol(send[0], send[1], send[2], send[3], send[4], send[5]);
            }

            Debug.Log("Pollice: " + send[4] + " Indice: " + send[0] + " Medio: " + send[1] + " Anuce: " + send[2] + " Mignolo: " + send[3] + " Mano: " + send[5]);
            //FollowSerial.sendAllProtocol(send[0],send[1],send[2],send[3],send[4],send[5]);
        }

        //	FollowSerial.sendAllProtocol ();
    }