public void Awake()
 {
     SimpleGesture.On4AxisSwipeRight(SwipeRight);
     SimpleGesture.On4AxisSwipeDown(SwipeDown);
     SimpleGesture.On4AxisSwipeLeft(SwipeLeft);
     SimpleGesture.On4AxisSwipeUp(SwipeUp);
 }
 void Awake()
 {
     SimpleGesture.WhilePinching(ZoomOut);
     SimpleGesture.WhileStretching(ZoomIn);
     SimpleGesture.WhileTwisting(Rotate);
     SimpleGesture.While1FingerPanning(Move);
 }
Exemplo n.º 3
0
 void Start()
 {
     // Support for gestures
     SimpleGesture.On4AxisFlickSwipeUp(() => SwipeCallback(Direction.UP));
     SimpleGesture.On4AxisFlickSwipeDown(() => SwipeCallback(Direction.DOWN));
     SimpleGesture.On4AxisFlickSwipeLeft(() => SwipeCallback(Direction.LEFT));
     SimpleGesture.On4AxisFlickSwipeRight(() => SwipeCallback(Direction.RIGHT));
 }
Exemplo n.º 4
0
    void Awake()
    {
        if (instance != null)
        {
            GameObject.Destroy(instance);
        }
        else
        {
            instance = this;
        }

        DontDestroyOnLoad(instance);
    }
Exemplo n.º 5
0
        // Crea un gesto y le carga los estados y tiempos que lo componen
        internal void makeGesture(String gestureName)
        {
            SimpleGesture sA = new SimpleGesture(gestureName);

            for (int i = 0; i < myPartialGestures.Count; i++)
            {
                sA.addPairStateTime(myPartialGestures[i]);
            }

            myPartialGestures = new List <Pair>();

            myGestures.Add(sA);
        }
Exemplo n.º 6
0
    // INITIALIZE: -----------------------------------------------------------------------------------------------------

    public void Awake()
    {
        TestsManager._instance      = this;
        Application.targetFrameRate = 60;

        this.AddMessage("Console");
        SimpleGesture.OnTap(this.CallbackTap);
        SimpleGesture.On4AxisFlickSwipeUp(this.CallbackSwipeUp);
        SimpleGesture.On4AxisFlickSwipeDown(this.CallbackSwipeDown);
        SimpleGesture.On4AxisFlickSwipeLeft(this.CallbackSwipeLeft);
        SimpleGesture.OnCircle(this.CallbackCircle);
        SimpleGesture.OnZigZag(this.CallbackZigZag);

        SimpleGesture.WhilePanning(this.CallbackPanning);
        SimpleGesture.WhilePinching(this.CallbackPinching);
        SimpleGesture.WhileStretching(this.CallbackStretching);
        SimpleGesture.WhileTwisting(this.CallbackTwisting);
    }
Exemplo n.º 7
0
    // INITIALIZE: -----------------------------------------------------------------------------------------------------

    public void Awake()
    {
        TestsManager._instance = this;

        this.AddMessage("Console");

        SimpleGesture.OnTap(this.CallbackTap);
        SimpleGesture.OnDoubleTap(this.CallbackDoubleTap);

        SimpleGesture.On4AxisSwipeDown(this.CallbackSwipeDown);
        SimpleGesture.On4AxisSwipeUp(this.CallbackSwipeUp);

        SimpleGesture.WhilePanning(this.CallbackPanning);
        SimpleGesture.WhilePinching(this.CallbackPinching);

        SimpleGesture.WhileStretching(this.CallbackStretching);
        SimpleGesture.WhileTwisting(this.CallbackTwisting);
    }
Exemplo n.º 8
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        isManipulating = false;
        Recognizer     = new GestureRecognizer();
        //click
        Recognizer.SetRecognizableGestures(GestureSettings.ManipulationTranslate);

        //the event to listen to
        Recognizer.ManipulationStartedEvent   += Started;
        Recognizer.ManipulationUpdatedEvent   += Updated;
        Recognizer.ManipulationCanceledEvent  += Ended;
        Recognizer.ManipulationCompletedEvent += Ended;

        Recognizer.StartCapturingGestures();
    }
 public static void Stop4AxisFlickSwipeDown(GestureDelegate <GestureInfoSwipe> method)
 {
     SimpleGesture.SwipeFlick_SubsMethod(E_DIRECTION.DWN, method, true);
 }
 public static void Stop9AxisFlickSwipeDiagonalLeftDown(GestureDelegate <GestureInfoSwipe> method)
 {
     SimpleGesture.SwipeFlick_SubsMethod(E_DIRECTION.DDL, method, false);
 }
Exemplo n.º 11
0
        private void ProcessGestureVector(Vector3 vector)
        {
            if (vector.Length() > minimumGestureLength)
            {
                double maxLength = 0;
                SimpleGesture selectedGesture = SimpleGesture.None;

                /* main direction */
                foreach (var item in gestureDirections)
                {
                    var d = Vector3.Dot(vector, item.Value);
                    currentGestureWeights[item.Key] = Math.Max(0, d);

                    if (d > minimumGestureLength && d > maxLength)
                    {
                        maxLength = d;
                        selectedGesture = item.Key;
                    }
                }

                if (selectedGesture != SimpleGesture.None)
                {
                    currentGesture = selectedGesture;

                    /* weights */
                    foreach (var item in gestureDirections)
                    {
                        currentGestureWeights[item.Key] /= maxLength;
                    }

                    idle = false;
                }
                else
                    idle = true;
            }
            else
                idle = true;
        }
 public static void StopStretching(GestureDelegate <GestureInfoZoom> method)
 {
     SimpleGesture.TwoFingerGesture_SubsMethod(E_2FINGERSCOMMON.STRETCHING, method);
 }
 public static void WhilePinching(GestureDelegate <GestureInfoZoom> method)
 {
     SimpleGesture.TwoFingerGesture_AddMethod(E_2FINGERSCOMMON.PINCHING, method);
 }
 public static void WhileTwisting(GestureDelegate method)
 {
     SimpleGesture.TwoFingerGesture_AddMethod(E_2FINGERSCOMMON.TWISTING, method);
 }
 public static void WhilePanning(GestureDelegate method)
 {
     SimpleGesture.TwoFingerGesture_AddMethod(E_2FINGERSCOMMON.PANNING, method);
 }
 public static void Stop9AxisFlickSwipeDiagonalRightUp(GestureDelegate method)
 {
     SimpleGesture.SwipeFlick_SubsMethod(E_DIRECTION.DUR, method, false);
 }
 public static void OnFlickSwipe(GestureDelegate method)
 {
     SimpleGesture.SwipeFlick_AddMethod(E_DIRECTION.ANY, method, false);
 }
 public static void On9AxisFlickSwipeDiagonalLeftDown(GestureDelegate method)
 {
     SimpleGesture.SwipeFlick_AddMethod(E_DIRECTION.DDL, method, false);
 }
Exemplo n.º 19
0
 public void Reset()
 {
     lastPoint = null;
     updateTimer.Stop();
     currentGesture = SimpleGesture.None;
 }
 public static void On4AxisFlickSwipeDown(GestureDelegate method)
 {
     SimpleGesture.SwipeFlick_AddMethod(E_DIRECTION.DWN, method, true);
 }
 public static void OnSwipe(GestureDelegate <GestureInfoSwipe> method)
 {
     SimpleGesture.Swipe9Axis_AddMethod(E_DIRECTION.ANY, method);
 }
 public static void Stop9AxisFlickSwipeDown(GestureDelegate method)
 {
     SimpleGesture.SwipeFlick_SubsMethod(E_DIRECTION.DWN, method, false);
 }
 public static void Stop4AxisFlickSwipeUp(GestureDelegate method)
 {
     SimpleGesture.SwipeFlick_SubsMethod(E_DIRECTION.UPR, method, true);
 }
Exemplo n.º 24
0
        public void Update(SimpleGesture gesture)
        {
            if (gesture != SimpleGesture.None)
            {
                double closeness;

                /* check for a progress in the previous states */
                for (int i = 0; i < CurrentStates.Count; i++)
                {
                    var state = CurrentStates[i];

                    closeness = SimpleGestureClosenessEvaluator.Compare(Descriptor[state.CurrentState], gesture);

                    if (closeness > 0)
                    {
                        /* next state */

                        if (closeness == 1)
                        {
                            /* full transition */
                            state.CurrentState++;
                            state.CurrentScore += closeness;
                        }
                        else
                        {
                            /* full transition + another instance staying in the same state */
                            state.CurrentState++;
                            state.CurrentScore += closeness;

                            CurrentStates.Insert(i, new RecognitionState() { CurrentScore = state.CurrentScore, CurrentState = state.CurrentState - 1 });

                            /* do not process it now */
                            i++;
                        }
                    }
                    else
                    {
                        /* not recognized */
                        CurrentStates.RemoveAt(i);
                        i--;
                    }
                }

                /* compare for a new entry in the state machine */
                closeness = SimpleGestureClosenessEvaluator.Compare(Descriptor[0], gesture);
                if (closeness > 0)
                {
                    var newState = new RecognitionState() { CurrentState = 1, CurrentScore = closeness };
                    CurrentStates.Add(newState);
                }

                /* check for validation */
                Valid = false;

                for (int i = 0; i < CurrentStates.Count; i++)
                {
                    var state = CurrentStates[i];

                    if (state.CurrentState >= Descriptor.Count)
                    {
                        Valid = true;
                        Score = state.CurrentScore;

                        CurrentStates.RemoveAt(i);
                        break;
                    }
                }

                if (Valid)
                {
                    /* sequence recognized, clear states */
                    CurrentStates.Clear();
                }
            }
        }
 public static void On9AxisFlickSwipeDown(GestureDelegate <GestureInfoSwipe> method)
 {
     SimpleGesture.SwipeFlick_AddMethod(E_DIRECTION.DWN, method, false);
 }
 public static void WhileStretching(GestureDelegate method)
 {
     SimpleGesture.TwoFingerGesture_AddMethod(E_2FINGERSCOMMON.STRETCHING, method);
 }
 public static void On9AxisFlickSwipeDiagonalLeftUp(GestureDelegate <GestureInfoSwipe> method)
 {
     SimpleGesture.SwipeFlick_AddMethod(E_DIRECTION.DUL, method, false);
 }
 public static void StopPinching(GestureDelegate method)
 {
     SimpleGesture.TwoFingerGesture_SubsMethod(E_2FINGERSCOMMON.PINCHING, method);
 }
 public static void On4AxisFlickSwipeUp(GestureDelegate <GestureInfoSwipe> method)
 {
     SimpleGesture.SwipeFlick_AddMethod(E_DIRECTION.UPR, method, true);
 }
 public static void StopPanning(GestureDelegate <GestureInfoPan> method)
 {
     SimpleGesture.TwoFingerGesture_SubsMethod(E_2FINGERSCOMMON.PANNING, method);
 }
 public static void Stop9AxisFlickSwipeUp(GestureDelegate <GestureInfoSwipe> method)
 {
     SimpleGesture.SwipeFlick_SubsMethod(E_DIRECTION.UPR, method, false);
 }
 public static void StopTwisting(GestureDelegate <GestureInfoTwist> method)
 {
     SimpleGesture.TwoFingerGesture_SubsMethod(E_2FINGERSCOMMON.TWISTING, method);
 }
 public static void On9AxisFlickSwipeUp(GestureDelegate method)
 {
     SimpleGesture.SwipeFlick_AddMethod(E_DIRECTION.UPR, method, false);
 }