// Update is called once per frame
    void Update()
    {
        Eyes       EyeData            = new Eyes();
        float      LeftEyeOpenAmount  = -1;
        float      RightEyeOpenAmount = -1;
        Vector3    FixationPointValue;
        Vector3    PositionLeft;
        Vector3    PositionRight;
        Quaternion RotationLeft;
        Quaternion RotationRight;

        if (m_Device.isValid)
        {
            if (m_Device.TryGetFeatureValue(m_Usage.As <Eyes>(), out EyeData))
            {
                EyeData.TryGetLeftEyeOpenAmount(out LeftEyeOpenAmount);
                EyeOpenAmountLeft.text = LeftEyeOpenAmount.ToString();
                EyeData.TryGetRightEyeOpenAmount(out RightEyeOpenAmount);
                EyeOpenAmountRight.text = RightEyeOpenAmount.ToString();

                EyeData.TryGetFixationPoint(out FixationPointValue);
                FixationPoint.text = FixationPointValue.ToString();

                EyeData.TryGetLeftEyePosition(out PositionLeft);
                EyePositionLeft.text = PositionLeft.ToString();
                EyeData.TryGetRightEyePosition(out PositionRight);
                EyePositionRight.text = PositionRight.ToString();

                EyeData.TryGetLeftEyeRotation(out RotationLeft);
                EyeRotationLeft.text = RotationLeft.ToString();
                EyeData.TryGetRightEyeRotation(out RotationRight);
                EyeRotationRight.text = RotationRight.ToString();
            }
        }
    }
Ejemplo n.º 2
0
        private void MyButtons(object sender, EventArgs e)
        {
            String n;

            Beepsound.Play();
            int numberRight, PositionRight;
            //determine which button was clicked
            Button ClickedButton;

            ClickedButton = (Button)sender;
            //button text is clicked number
            n = ClickedButton.Text;
            //disable button since digits can't repeat
            ClickedButton.Enabled = false;
            //if first button is combo, clear out label boxes
            if (digitsEntered == 0)
            {
                Combo[0].Text = "";
                Combo[1].Text = "";
                Combo[2].Text = "";     // these clear labels after each combo, so next cobo can be inputed
                Combo[3].Text = "";
                Combo[4].Text = "";
            }
            //add button to code
            EnteredCombo += n;                 //entered value of button to "entered combo"
            digitsEntered++;
            Combo[digitsEntered - 1].Text = n; // changes the text in label to the value of the clicked button
            // if all digits entered, check combo
            if (digitsEntered == NumberDigits)
            {
                Attempts += 1;
                //reset combo buttons
                for (int i = 0; i < 9; i++)
                {
                    ComboButton[i].Enabled = true;
                }
                txtResults.AppendText("Entered : " + EnteredCombo + "\r\n");
                if (EnteredCombo == SecretCombo) //checks if entered combo matches the secret combo
                {
                    btnStart.PerformClick();
                }
                else
                {
                    numberRight = 0;
                    for (int i = 0; i < NumberDigits; i++)
                    {
                        n = EnteredCombo[i].ToString();
                        for (int j = 0; j < NumberDigits; j++)
                        {
                            if (n == SecretCombo[j].ToString()) // checks if one of the entered digits is one of the digits in the Secretcombo
                            {
                                numberRight++;
                            }
                        }
                    }
                    //how many in correct position
                    PositionRight = 0;
                    for (int i = 0; i < NumberDigits; i++)
                    {
                        if (SecretCombo[i] == EnteredCombo[i])
                        {
                            PositionRight++;
                        }
                    }
                    txtResults.AppendText(numberRight.ToString() + " digits correct" + "\r\n");
                    txtResults.AppendText(PositionRight.ToString() + " in correct position" + "\r\n");
                    txtResults.AppendText("Try Again ..." + "\r\n\r\n");
                    //clear combo to try again
                    EnteredCombo  = "";
                    digitsEntered = 0;
                    //Q4 "numberRight" checks if one of the entered digits is one of the digits in the Secretcombo
                    //while position right checks each digit in your entered combo and compares with the secret combo to see if it is in the right spot
                }
            }
        }