Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.9 kB
1
Indexable
Never
IEnumerator SendVibration(){

        yield return new WaitForSeconds(0.1f);
        //if(!Trials.vibrazioneLanciata){
            //inizioCor = Time.time;
        if(Trials.randN1!=3 && Trials.randN1!=4){
            if(Trials.randN2 == 0){
                yield return new WaitForSeconds(0.433f);
                GameObject.Find("Haptics").GetComponent<Haptics>().Pulse(0.020f, 150, 0.8f, SteamVR_Input_Sources.RightHand);
                timeVibr = Time.time;
                //Debug.Log("Vibrazione ->" + (Time.time-inizioCor));
                vibrazione = false;
                Trials.vibrazioneLanciata = true;
                yield return new WaitForSeconds(2.6f-0.433f);
            } else if(Trials.randN2 == 1 ){
                yield return new WaitForSeconds(0.866f);
                GameObject.Find("Haptics").GetComponent<Haptics>().Pulse(0.020f, 150, 0.8f, SteamVR_Input_Sources.RightHand);
                timeVibr = Time.time;
                Trials.vibrazioneLanciata = true;
                //Debug.Log("Vibrazione ->" + (Time.time-inizioCor));
                vibrazione = false;
                
                yield return new WaitForSeconds(2.6f-0.866f);
            } else if(Trials.randN2 == 2){
                yield return new WaitForSeconds(1.299f);
                GameObject.Find("Haptics").GetComponent<Haptics>().Pulse(0.020f, 150, 0.8f, SteamVR_Input_Sources.RightHand);
                timeVibr = Time.time;
                //Debug.Log("Vibrazione ->" + (Time.time-inizioCor));
                vibrazione = false;
                Trials.vibrazioneLanciata = true;
                yield return new WaitForSeconds(2.6f-1.299f);
            } else if(Trials.randN2 == 3){
                yield return new WaitForSeconds(1.732f);
                GameObject.Find("Haptics").GetComponent<Haptics>().Pulse(0.020f, 150, 0.8f, SteamVR_Input_Sources.RightHand);
                timeVibr = Time.time;
                //Debug.Log("Vibrazione ->" + (Time.time-inizioCor));
                vibrazione = false;
                Trials.vibrazioneLanciata = true;
                yield return new WaitForSeconds(2.6f-1.732f);
            } else{
                yield return new WaitForSeconds(2.165f);
                GameObject.Find("Haptics").GetComponent<Haptics>().Pulse(0.020f, 150, 0.8f, SteamVR_Input_Sources.RightHand);
                timeVibr = Time.time;
                //Debug.Log("Vibrazione ->" + (Time.time-inizioCor));
                vibrazione = false;
                Trials.vibrazioneLanciata = true;
                yield return new WaitForSeconds(2.6f-2.165f);
            }
        } else{
            yield return new WaitForSeconds(2.6f);
            Haptics.scriviRit(true);
            //Debug.Log(Haptics.numTrial);
            Haptics.numTrial++;
        }
            Trials.pallinaFerma = true;
            Trials.rb.velocity = new Vector3(0, 0, 0);
            
        //}
    }