Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        _timer += Time.deltaTime;

        if (OVRInput.Get(OVRInput.Axis1D.SecondaryIndexTrigger, OVRInput.Controller.Touch) > 0.5 && _timer >= TimeBetweenBullets)
        {
            _wandSound.Play();
            _canShoot = true;
        }

        if (_timer >= TimeBetweenBullets * _effectsDisplayTime)
        {
            DisableEffects();
        }

        if (_timer >= TimeBetweenBullets)
        {
            _wandFlare.brightness = 0.3f;
        }

        if (_canShoot)
        {
            if (_timeDelayShoot >= _timeDelayDefault)
            {
                Shoot();
                _timeDelayShoot       = 0f;
                _canShoot             = false;
                _wandFlare.brightness = 0;
                rightControllerHaptics.Vibrate(VibrationForce.Hard);
            }

            _timeDelayShoot += Time.deltaTime;
        }
    }
Esempio n. 2
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Q))
     {
         leftControllerHaptics.Vibrate(VibrationForce.Hard);
         rightControllerHaptics.Vibrate(VibrationForce.Light);
     }
 }
Esempio n. 3
0
    public static void VibrateTouch(Collider other)
    {
        leftControllerHaptics  = GameObject.Find("LeftHandAnchor").GetComponent <OculusHapticsController>();
        rightControllerHaptics = GameObject.Find("RightHandAnchor").GetComponent <OculusHapticsController>();

        // declare an empty pointer to locate which object did the button pushing
        GameObject pusher;

        switch (other.name)
        {
        case "HandCollider":
            pusher = other.transform.parent.gameObject;
            break;

        case "LeftHandAnchor":
            pusher = other.gameObject;
            break;

        case "RightHandAnchor":
            pusher = other.gameObject;
            break;


        default:
            pusher = other.GetComponent <CollisionHaptics>().pusher;
            break;
        }

        // VIBRATE the corresponding controller
        if (pusher == leftControllerHaptics.gameObject)
        {
            leftControllerHaptics.Vibrate(VibrationForce.Hard);
        }
        if (pusher == rightControllerHaptics.gameObject)
        {
            rightControllerHaptics.Vibrate(VibrationForce.Hard);
        }
    }
    void Update()
    {
        //A Button on R Controller
        //Turns on Laser Pointer
        //probably a temp function for now.
        if (OVRInput.Get(OVRInput.Button.Two))
        {
//			Debug.LogError ("u pressed A");
//			conAnchorR.transform.Find ("ControllerLaserPointer").gameObject.SetActive (true);
            laserR.SetActive(true);
        }
        else
        {
//			conAnchorR.transform.Find ("ControllerLaserPointer").gameObject.SetActive (false);
            laserR.SetActive(false);
        }


        //X Button on L Controller
        //Turns on Laser Pointer
        //probably a temp function for now.
        if (OVRInput.Get(OVRInput.Button.Four))
        {
            laserL.SetActive(true);
        }
        else
        {
            laserL.SetActive(false);
        }


        if (Input.GetKey(KeyCode.Space))    //spacebar debug========================================================
        {
            leftControllerHaptics.Vibrate(VibrationForce.Hard);
            rightControllerHaptics.Vibrate(VibrationForce.Light);
        }

        //Start button on L Controller
        //put the control for start button in the Pause script from the Game Jam package that controls UI


        //Trigger on L Controller & R Controller
        //pulls node to controller
        //changed my mind, let's put this in CUI_ViveLaserBeam
//		if (OVRInput.Get(OVRInput.RawButton.LIndexTrigger) && laserL.GetComponent<CUI_ViveLaserBeam>().IsHittingNode()) {
//
//		}



        //D-pad on L Controller
        //opens menu and sets tool
        Vector2 dPadLeft = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);

        if (dPadLeft.x != 0f || dPadLeft.y != 0f)
        {
            menuL.SetActive(true);
            SelectTool(dPadLeft);
            menuL.GetComponent <ItemMenuBehaviour> ().HighlightTool(selectedTool);
            toolsR.SelectTool(selectedTool);
//			Debug.LogError ("x: " + dPadLeftConX + " and y: " + dPadLeftConY);
            //SelectTool(Vector2) -> this changes a variable (int?) called selectedTool
            //maybe make it an public array of strings for clarity of code down the line?
//			Debug.LogError (selectedTool);
        }
        else
        {
            menuL.SetActive(false);
        }
    }
 void PlayHaptics(Collider c)
 {
     Haptic.Vibrate(VibrationForce.Hard);
 }