Esempio n. 1
0
        private void Update()
        {
            if (!RecordAllTouches || Input.touchCount <= 0)
            {
                return;
            }

            for (var i = 0; i < Input.touchCount; i++)
            {
                var theTouch = Input.GetTouch(i);

                switch (theTouch.phase)
                {
                case TouchPhase.Began:
                    try
                    {
                        _touchePhases[i] = TouchPhase.Began;
                    }
                    catch (Exception)
                    {
                        _touchePhases.Add(i, TouchPhase.Began);
                    }

                    try
                    {
                        _starTuples[i] = new Tuple <float, float>(theTouch.position.x, theTouch.position.y);
                    }
                    catch (Exception)
                    {
                        _starTuples.Add(i, new Tuple <float, float>(theTouch.position.x, theTouch.position.y));
                    }

                    break;

                case TouchPhase.Moved:
                    _touchePhases[i] = TouchPhase.Moved;
                    break;

                case TouchPhase.Ended:
                    switch (_touchePhases[i])
                    {
                    case TouchPhase.Began:
                        PROBA.TapEvent(TapTypes.Tap, startX: _starTuples[i].Item1, startY: _starTuples[i].Item2);
                        break;

                    case TouchPhase.Moved:
                        PROBA.TapEvent(TapTypes.Sweep, startX: _starTuples[i].Item1, startY: _starTuples[i].Item2, endX: theTouch.position.x, endY: theTouch.position.y);
                        break;
                    }

                    _touchePhases[i] = TouchPhase.Ended;
                    break;
                }
            }
        }