void OnSwipe(SwipeGestureRecognizer source) { // make sure we started the swipe gesture on our swipe object GameObject selection = PickObject(source.StartPosition); if (selection == sphereObject) { UI.StatusText = "Swiped " + source.Direction + " with velocity: " + source.Velocity; SwipeParticlesEmitter emitter = selection.GetComponentInChildren <SwipeParticlesEmitter>(); if (emitter) { emitter.Emit(source.Direction, source.Velocity); } } }
// spin the yellow cube when swipping it void FingerGestures_OnTwoFingerSwipe(Vector2 startPos, FingerGestures.SwipeDirection direction, float velocity) { // make sure we started the swipe GestureMagon our swipe object GameObject selection = PickObject(startPos); if (selection == swipeObject) { UI.StatusText = "Swiped " + direction + " with two fingers"; SwipeParticlesEmitter emitter = selection.GetComponentInChildren <SwipeParticlesEmitter>(); if (emitter) { emitter.Emit(direction, velocity); } } }
// spin the yellow cube when swipping it void OnSwipe(SwipeGesture gesture) { // make sure we started the swipe gesture on our swipe object GameObject selection = gesture.StartSelection; // we use the object the swipe started on, instead of the current one if (selection == swipeObject) { UI.StatusText = "Swiped " + gesture.Direction + " with finger " + gesture.Fingers[0] + " (velocity:" + gesture.Velocity + ", distance: " + gesture.Move.magnitude + " )"; Debug.Log(UI.StatusText); SwipeParticlesEmitter emitter = selection.GetComponentInChildren <SwipeParticlesEmitter>(); if (emitter) { emitter.Emit(gesture.Direction, gesture.Velocity); } } }