Ejemplo n.º 1
0
    void CalibratePointer()
    {
        HapticPointer hp = GameObject.Find(selectedPointer).GetComponent <HapticPointer>();

        hp.Calibrate();
        Invoke("CatchObject", 0.1f);
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.I))
        {
            showInformation = !showInformation;
        }
        else if (Input.GetKeyDown(KeyCode.M))
        {
            _currentPointer++;
            if (_currentPointer >= _pointers.Length)
            {
                _currentPointer = 0;
            }
            _currentPointerName = _pointers.Length > 0 ? _pointers[_currentPointer].name : "";
        }

        if (_pointers.Length == 0)
        {
            return;
        }

        HapticPointer hp = _pointers[_currentPointer];

        if (hp.ToggleHold)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (!hp.ReleaseObject())
                {
                    hp.HoldObject();
                }
            }
        }
        else
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                hp.HoldObject();
            }

            if (Input.GetKeyUp(KeyCode.Space))
            {
                hp.ReleaseObject();
            }
        }

        if (hp.ToggleClutch)
        {
            if (Input.GetKeyDown(KeyCode.V))
            {
                if (!hp.ReleaseClutch())
                {
                    hp.EngageClutch();
                }
            }
        }
        else
        {
            if (Input.GetKeyDown(KeyCode.V))
            {
                hp.EngageClutch();
            }

            if (Input.GetKeyUp(KeyCode.V))
            {
                hp.ReleaseClutch();
            }
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            hp.Calibrate();
        }
    }