Exemple #1
0
 /// <summary>
 /// Observable ValueChanged event
 /// </summary>
 /// <param name="events"></param>
 /// <returns></returns>
 public static IObservable <Control3DEventArgs> ValueChangedAsObservable(this VRTK_Lever events)
 {
     return(Observable.FromEvent <Control3DEventHandler, Control3DEventArgs>(
                h => (s, e) => h(e),
                h => events.ValueChanged += h,
                h => events.ValueChanged -= h));
 }
Exemple #2
0
    private void checkAnswer()
    {
        VRTK_Lever lev            = lever.GetComponent <VRTK_Lever>();
        Transform  selectedAnswer = null;

        if (lev.CalculateValue() < -15)
        {
            selectedAnswer = top;
            //        print("slected top");
        }
        if (lev.CalculateValue() > 15)
        {
            selectedAnswer = bottom;
            //       print("selectbottom");
        }
        // if (selectedAnswer == getAnswer())
        if ((selectedAnswer == top && getAnswer() == top) || selectedAnswer == bottom && getAnswer() == bottom)
        {
            AudioSource aud = getAudio();
            aud.Play();
        }
        else if (selectedAnswer == null)
        {
            //print("nothing chosen");
        }
        else
        {
            //        print("wrong");
            AudioSource errorSound = soundHolder.GetComponent <AudioSource>();
            errorSound.Play();
        }
    }
Exemple #3
0
    void lev()
    {
        bool       triggered = false;
        VRTK_Lever l         = child.GetComponent <VRTK_Lever>();
        float      num       = 45;

        if (l.CalculateValue() > num)
        {
            print("hello");
        }
    }
    void lev()
    {
        bool       triggered = false;
        VRTK_Lever l         = child.GetComponent <VRTK_Lever>();
        float      num       = 45; //basically modify this value to test what numerical values correspond to an angle on the lever - it can be hard to tell what 45degrees is when you are twisting the levers around in 3d space basically

        if (l.CalculateValue() > num)
        {
            print("hello");
        }
    }
Exemple #5
0
    // Update is called once per frame
    void Update()
    {
        VRTK_Lever l   = child.GetComponent <VRTK_Lever>();
        float      num = 45;

        if (l.CalculateValue() > num)
        {
            if (lever != null)
            {
                lever();
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        //     resetScript r = this.GetComponent<resetScript>();

        VRTK_Lever l = child.GetComponent <VRTK_Lever>();

        VRTK_Lever aud = auditory.GetComponent <VRTK_Lever>();

        VRTK_Lever vis = visual.GetComponent <VRTK_Lever>();

        VRTK_Lever sos = ss.GetComponent <VRTK_Lever>();

        VRTK_Lever gus = gustatory.GetComponent <VRTK_Lever>();

        textParse txt = parent.GetComponent <textParse>();

        List <string> arr = new List <string>();

        if (aud.CalculateValue() > 45 && trig == false)
        {
            List <string> arrr = txt.auditory();
            for (int i = 0; i < arrr.Count; i++)
            {
                arr.Add(arrr[i]);
            }
        }

        if (vis.CalculateValue() > 45 && trig == false)
        {
            List <string> arrr = txt.visual();
            for (int i = 0; i < arrr.Count; i++)
            {
                arr.Add(arrr[i]);
            }
        }
        if (sos.CalculateValue() > 45 && trig == false)
        {
            List <string> arrr = txt.somatosensory();
            for (int i = 0; i < arrr.Count; i++)
            {
                arr.Add(arrr[i]);
            }
        }
        if (gus.CalculateValue() > 45 && trig == false)
        {
            List <string> arrr = txt.gustatory();
            for (int i = 0; i < arrr.Count; i++)
            {
                arr.Add(arrr[i]);
            }
        }


        //  List<string> arr = txt.parse();
        //float angle = lev.

        if (l.CalculateValue() > 45 && trig == false)
        {
            trig = true;
            transformation(arr);
            for (int i = 0; i < arr.Count; i++)
            {
                //    print(arr[i]);
            }
        }
        if (l.CalculateValue() < 10 && trig == true)
        {
            trig = false;
            reset(arr);
        }
    }
    // Update is called once per frame
    void Update()
    {
        //     resetScript r = this.GetComponent<resetScript>();

        VRTK_Lever l = child.GetComponent <VRTK_Lever>();

        VRTK_Lever aud = auditory.GetComponent <VRTK_Lever>();

        VRTK_Lever vis = visual.GetComponent <VRTK_Lever>();

        VRTK_Lever sos = ss.GetComponent <VRTK_Lever>();

        VRTK_Lever gus = gustatory.GetComponent <VRTK_Lever>();

        textParse txt = parent.GetComponent <textParse>();

        List <string> arr = new List <string>();

        bool audActive = false;
        bool visActive = false;
        bool sosActive = false;
        bool gusActive = false;

        if (vis.CalculateValue() > 45 /*/ && trig == false/*/)
        {
            visActive = true;
            print("vis");
            List <string> arrr = txt.visual();
            for (int i = 0; i < arrr.Count; i++)
            {
                arr.Add(arrr[i]);
            }
        }
        if (aud.CalculateValue() > 45 /*/ && trig == false/*/)
        {
            audActive = true;
            print("aud");
            List <string> arrr = txt.auditory();
            for (int i = 0; i < arrr.Count; i++)
            {
                arr.Add(arrr[i]);
            }
        }

        if (sos.CalculateValue() > 45 /*/ && trig == false/*/)
        {
            sosActive = true;
            List <string> arrr = txt.somatosensory();
            for (int i = 0; i < arrr.Count; i++)
            {
                arr.Add(arrr[i]);
            }
        }
        if (gus.CalculateValue() > 45 /*/ && trig == false/*/)
        {
            gusActive = true;
            List <string> arrr = txt.gustatory();
            for (int i = 0; i < arrr.Count; i++)
            {
                arr.Add(arrr[i]);
            }
        }

        transformation(arr);
        if (!gusActive && !visActive && !sosActive && !audActive)
        {
            reset(arr);
        }
        //  List<string> arr = txt.parse();
        //float angle = lev.

/*/
 *      if (l.CalculateValue() > 45 && trig == false)
 *      {
 *          trig = true;
 *          transformation(arr);
 *          for(int i = 0; i<arr.Count; i++)
 *          {
 *          //    print(arr[i]);
 *          }
 *      }
 *      if (l.CalculateValue()<10 && trig == true)
 *      {
 *          trig = false;
 *          reset(arr);
 *      }
 *     /*/
    }
Exemple #8
0
    // Use this for initialization

    void Start()
    {
        VRTK_Lever l = child.GetComponent <VRTK_Lever>();
    }