Example #1
0
    private void SliderHandler(object sender, Control3DEventArgs args)
    {
        var value = args.value;

        Textmesh.text = "Height: " + args.normalizedValue.ToString() + "%";
        Map.position  = new Vector3(Map.position.x, 1.0f + ((float)value) / 50.0f, Map.position.z);
    }
    private void handlePush(object sender, Control3DEventArgs e)
    {
        if (buttonName == "LeftButton")
        {
            moleculeIndex -= 1;
        }
        else
        {
            moleculeIndex += 1;
        }

        if (moleculeIndex >= molecule.Length)
        {
            moleculeIndex = 0;
        }

        else if (moleculeIndex < 0)
        {
            moleculeIndex = molecule.Length - 1;
        }
        VRTK_Logger.Info(moleculeIndex.ToString() + " = molecule index");
        for (int i = 0; i < molecule.Length; i++)
        {
            molecule[i].SetActive(false);
        }
        molecule[moleculeIndex].gameObject.SetActive(true);
        tooltip_manager.setMoleculeIndex(moleculeIndex);
    }
Example #3
0
    private void HandleChange(object sender, Control3DEventArgs e)
    {
        if (ValueText != null)
        {
            if (options.Count > 0)
            {
                ValueText.text = options[(int)GetValue()];
            }
            else if (isInteger)
            {
                ValueText.text = ((int)GetValue()).ToString();
            }
            else
            {
                ValueText.text = GetValue().ToString("0.00");
            }
        }

        if (invokeObject != null)
        {
            if (isInteger)
            {
                invokeObject.SendMessage(methodName, (int)GetValue());
            }
            else
            {
                invokeObject.SendMessage(methodName, GetValue());
            }
        }
    }
Example #4
0
    private void handlePush(object sender, Control3DEventArgs e)
    {
        AudioSource audio = GetComponent <AudioSource>();

        if (attempt == code)
        {
            int min = Timer.min;
            int sec = Timer.sec;
            GetComponent <AudioSource>().clip = goodSound;
            GetComponent <AudioSource>().Play();
            float temp = Timer.timer - (min * 60 + sec);
            min = (int)(temp / 60f);
            sec = (int)(temp % 60f);
            congratz.GetComponentInChildren <Text>().text = String.Format("Félicitations ! \nVotre temps : {0:00}:{1:00}", min, sec);
            congratz.SetActive(true);
            StartCoroutine(EndGame());
        }
        else
        {
            GetComponent <AudioSource>().clip = badSound;
            GetComponent <AudioSource>().Play();
            attempt = "";
            Debug.Log("TRY AGAIN");
        }
    }
Example #5
0
        private void HandleChange(object sender, Control3DEventArgs e)
        {
            soundSource.Play();
            float diff = userWave.checkDiff();

            teleportPad.Teleport(diff);
        }
Example #6
0
 private void HandleButtonPushed(object sender, Control3DEventArgs e)
 {
     if (!isRestarting_)
     {
         isRestarting_ = true;
         SceneManager.LoadSceneAsync("Intro");
     }
 }
Example #7
0
 private void OnLeverPulled(object sender, Control3DEventArgs control3DEventArgs)
 {
     if (!leverThrown)
     {
         leverThrown = true;
         Next();
     }
 }
Example #8
0
        private void handlePush(object sender, Control3DEventArgs e)
        {
            VRTK_Logger.Info("Pushed");

            GameObject newGo = (GameObject)Instantiate(go, dispenseLocation.position, Quaternion.identity);

            Destroy(newGo, 10f);
        }
Example #9
0
 void end_button_pushed(object sender, Control3DEventArgs args)
 {
     Debug.Log("triggered end");
     text.text = "GOOD JOB!!";
     start_button.gameObject.SetActive(true);
     end_button.gameObject.SetActive(false);
     timerOn = false;
 }
Example #10
0
        private void HandleChange(object sender, Control3DEventArgs e)
        {
            go.text = e.value.ToString() + " Ω"; // normalizedValue: 百分数 20  value 2

            biLi   = e.normalizedValue / maxValue;
            pianYi = biLi /** 0.4f*/;
            pianYi = Mathf.Clamp(pianYi, 0, 0.4F);
            huaPian.localPosition = new Vector3(pianYi, posY, posZ);
        }
Example #11
0
        private void HandlePush(object sender, Control3DEventArgs e)
        {
            VRTK_Logger.Info("Pushed");
            var listBlocks = GetSnapDropZoneBlockGroup().GetListOfSnappedProgramBlocks();

            Debug.Log("HandlePush: list blocks count = " + listBlocks.Count);

            GetDecoder().Decode(listBlocks);
        }
 private void handlePush(object sender, Control3DEventArgs e)
 {
     if (e.normalizedValue > .8f)
     {
         VRTK_Logger.Info("Pushed");
         print("Button pushed");
     }
     //GameObject newGo = (GameObject)Instantiate(go, dispenseLocation.position, Quaternion.identity);
     //Destroy(newGo, 10f);
 }
Example #13
0
        private void handle_reject_push(object sender, Control3DEventArgs e)
        {
            Debug.Log("Reject Button Pushed");

            //            GameObject newGo = (GameObject)Instantiate(go, dispenseLocation.position, Quaternion.identity);
            //            Destroy(newGo, 10f);

            gc.destroy_instrument();
            gc.new_instrument();
        }
Example #14
0
        private void handlePush(object sender, Control3DEventArgs e)
        {
            VRTK_Logger.Info("Pushed");
            //akce:
            //GameObject newGo = (GameObject)Instantiate(go, dispenseLocation.position, Quaternion.identity);
            //Destroy(newGo, 10f);
            stav = !stav;

            switch (typeReactor)
            {
            case TR.noneR:
                break;

            case TR.lightR:
                oeLight1.enabled = !oeLight1.enabled;
                myLed.SetActive(oeLight1.enabled);
                break;

            case TR.soundR:
                oeAudio1.SetActive(stav);
                myLed.SetActive(stav);
                break;

            case TR.toolsR:
                oeTools.SetActive(stav);
                myLed.SetActive(stav);
                break;

            case TR.leftR:
                oeToolsL.SetActive(stav);
                myLed.SetActive(stav);
                break;

            case TR.rightR:
                oeToolsR.SetActive(stav);
                myLed.SetActive(stav);
                break;

            case TR.generatorR:
                oeGenerateObject();
                break;


            default:
                Debug.Log("err reactor Type");
                break;
            }



            if (debugLog)
            {
                Debug.Log("--- oeButtonReactor " + indexData + ": " + stav);
            }
        }
Example #15
0
 private void HandleChange(object sender, Control3DEventArgs e)
 {
     if (e.normalizedValue == 100)
     {
         light.enabled = true;
     }
     else if (e.normalizedValue == 0)
     {
         light.enabled = false;
     }
 }
Example #16
0
    void start_button_pushed(object sender, Control3DEventArgs args)
    {
        Debug.Log("triggered start");
        string choice = choices[UnityEngine.Random.Range(0, choices.Length)];

        text.text = "Draw a " + choice + "!!!!";
        start_button.gameObject.SetActive(false);
        end_button.gameObject.SetActive(true);
        time    = 0;
        timerOn = true;
    }
Example #17
0
    private void HandleWheelValueChanged(object sender, Control3DEventArgs e)
    {
        float valueDelta = Mathf.Abs(e.value - _previousValue);

        _currentCharge += valueDelta;
        _previousValue  = e.value;
        if (_controllerReference != null)
        {
            VRTK_ControllerHaptics.TriggerHapticPulse(_controllerReference, _windHapticStrength, 0.1f, 0.01f);
        }
    }
Example #18
0
        private void OnFaderValueChanged(object sender, Control3DEventArgs e)
        {
            float newGain = FaderPercentageToGain(e.normalizedValue);

            SetGainDisplayText(newGain);

            string     address      = "/" + Controller.GetID() + "/trackParam/volume";
            OscMessage volumeChange = new OscMessage(address, e.normalizedValue);

            oscEventDispatcher.SendOSCPacket(address, volumeChange);
        }
 private void handlePush(object sender, Control3DEventArgs e)
 {
     VRTK_Logger.Info("Pushed");
     if (lightOn)
     {
         TurnOffLightSwitch();
     }
     else
     {
         TurnOnLightSwitch();
     }
 }
 private void HandleChange(object sender, Control3DEventArgs e)
 {
     go.text = e.value.ToString() + "(" + e.normalizedValue.ToString() + "%)";
     if (isAngle == 1)
     {
         angle = (int)e.value;
     }
     else
     {
         speed = (int)e.value;
     }
 }
Example #21
0
        private void handlePush(object sender, Control3DEventArgs e)
        {
            if (start > 0)
            {
                VRTK_Logger.Info("Pushed");
                InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>();
                Script.FreezeAll();
                print("pressed");
            }

            start = 1;
        }
Example #22
0
 private void HandleChange(object sender, Control3DEventArgs e)
 {
     go.text = e.value.ToString() + "(" + e.normalizedValue.ToString() + "%)";
     if (e.value > 25)
     {
         Debug.Log("Done");
         foreach (GameObject door in doors)
         {
             door.GetComponent <VRTK_InteractableObject>().isGrabbable = true;
             door.GetComponent <Rigidbody>().isKinematic = false;
         }
     }
 }
Example #23
0
        private void HandleChange(object sender, Control3DEventArgs e)
        {
            //Debug.Log("" + e.normalizedValue);
            if (go != null)
            {
                go.text = e.value.ToString() + "(" + e.normalizedValue.ToString() + "%)";
            }

            /*if (e.normalizedValue == 75)
             * {
             *      //play sound for puzzle
             * }
             * else {
             *      //play static
             * }*/
        }
        private void HandleChange(object sender, Control3DEventArgs e)
        {
            if (freq)
            {
                userWave.changeFreq(index, (int)e.value);
            }
            if (amp)
            {
                userWave.changeAmp(index, e.value);
            }

            int ran = Random.Range(0, sounds.Length);

            soundSource.clip = sounds[ran];
            soundSource.Play();
        }
Example #25
0
        private void HandleChange(object sender, Control3DEventArgs e)
        {
            float t = this.transform.localRotation.eulerAngles.z;

            if (t > 110)
            {
                shipFloatController.leaverValue = 1;
            }
            else if (t < 70)
            {
                shipFloatController.leaverValue = -1;
            }
            else
            {
                shipFloatController.leaverValue = 0;
            }
        }
Example #26
0
    private void SliderHandler(object sender, Control3DEventArgs args)
    {
        var value = args.value;

        Textmesh.text = "Tilt: " + args.normalizedValue.ToString() + "%";
        Map.rotation  = Quaternion.Euler(Map.rotation.x, Map.rotation.y, Map.rotation.z + ((float)value));
        Debug.Log("Update: " + Map.rotation.ToString());

//        if (SteamVR.instance != null && SteamVR.instance.overlay != null) {
//            SteamVR.instance.overlay.ShowKeyboard(
//                eInputMode: 0,
//                eLineInputMode: 0,
//                pchDescription: "IP",
//                unCharMax: 256,
//                pchExistingText: "",
//                bUseMinimalMode: true,
//                uUserValue: 0);
//        }
    }
Example #27
0
 private void handlePush(object sender, Control3DEventArgs e)
 {
     if (firstHit && secondHit) //Actif quand deux tirs ont été réalisé
     {
         firstHit  = false;     //Remise a zero
         secondHit = false;
     }
     if (!firstHit)    //si premier appui
     {
         // Debug.Log("play ouverture");
         firstHit = true;
         anim.Play(Animation1);
         return;
     }
     if (firstHit && !secondHit)    //si second appui
     {
         // Debug.Log("play Fermeture");
         secondHit = true;
         anim.Play(Animation2);
         return;
     }
 }
Example #28
0
        // Update is called once per frame
        void Update()
        {
            if (gripIsGrabbed)
            {
                Vector3 targetPosition = Utility.ProjectPointOnSegment(gripHandle.transform.position, railStart.position, railEnd.position);
                gripTransform.position = Vector3.Lerp(gripTransform.position, targetPosition, Time.deltaTime * FaderSnapSpeed);

                if (Vector3.Distance(gripTransform.position, lastGripTransformPosition) > ChangeEventDistance)
                {
                    lastGripTransformPosition = gripTransform.position;

                    if (FaderValueChanged != null)
                    {
                        Control3DEventArgs e = new Control3DEventArgs();

                        float startDistance = Vector3.Distance(gripTransform.position, railStart.position);
                        e.value           = startDistance;
                        e.normalizedValue = startDistance / railLength;

                        FaderValueChanged(this, e);
                    }
                }
            }
        }
Example #29
0
 private void HandleChange(object sender, Control3DEventArgs e)
 {
     go.text = e.value.ToString();// + "(" + e.normalizedValue.ToString() + "%)";
 }
Example #30
0
 protected virtual void HandleChange(object sender, Control3DEventArgs e)
 {
 }