private void Update()
        {
            var deltaTouch = NRInput.GetDeltaTouch();

            if (deltaTouch.y > float.Epsilon)
            {
                return;
            }

            var isSwipeRight = deltaTouch.x > float.Epsilon;
            var isSwipeLeft  = deltaTouch.x < -float.Epsilon;

            switch (_state)
            {
            case State.Disabled:
                break;

            case State.Idle:
                if (isSwipeRight)
                {
                    StartCoroutine(nameof(Record));
                }
                break;

            case State.Record:
                if (isSwipeLeft)
                {
                    StartCoroutine(nameof(Stop));
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private void Update()
        {
            var deltaTouch = NRInput.GetDeltaTouch();

            if (deltaTouch.y > float.Epsilon)
            {
                return;
            }

            var isSwipeRight = deltaTouch.x > float.Epsilon;
            var isSwipeLeft  = deltaTouch.x < -float.Epsilon;

            switch (_state)
            {
            case State.Idle:
                if (isSwipeRight)
                {
                    StartCoroutine(nameof(Play));
                }
                break;

            case State.Play:
                if (isSwipeLeft)
                {
                    StartCoroutine(nameof(Stop));
                }
                else if (NRInput.GetButtonUp(ControllerButton.TRIGGER))
                {
                    StartCoroutine(nameof(Pause));
                }
                break;

            case State.Pause:
                if (isSwipeLeft)
                {
                    StartCoroutine(nameof(Stop));
                }
                else if (NRInput.GetButtonUp(ControllerButton.TRIGGER))
                {
                    StartCoroutine(nameof(Play));
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #3
0
    void Update()
    {
        //get controller rotation, and set the value to the cube transform
        // transform.rotation = NRInput.GetRotation();

        Vector2 vec = NRInput.GetDeltaTouch();

        //Debug.Log(vec.x);
        if (Mathf.Abs(vec.x) >= Mathf.Abs(vec.y))
        {
            // TODO Implement
        }
        else
        {
            if (vec.y <= 0)  // swipe down in emu; swipe up on real device
            {
                // => zoom out
                // Linear method
                Vector3 newVal = transform.localScale * 0.985f;
                if (newVal.x >= 0.01)    // set a minimum value
                {
                    transform.localScale = newVal;
                }

                // alternative: Addition
                //transform.localScale -= new Vector3(0.05f, 0.05f, 0.05f);
            }
            else  // swipe up in emu; swipe up on real device
            {
                // => zoom in
                // Linear method
                transform.localScale *= 1.015f;

                // alternative: Addition
                //transform.localScale += new Vector3(0.075f, 0.075f, 0.075f);
            }
        }
    }