using UnityEngine; using System.Collections; /// /// Base class used by most common gestures that can be performed with /// and arbitrary number of fingers, such as drag, tap, swipe... /// /// The position of the fingers are averaged and stored in the /// StartPosition and/or Position fields /// public abstract class AveragedGestureRecognizer : GestureRecognizer { /// /// Exact number of touches required for the gesture to be recognized /// public int RequiredFingerCount = 1; Vector2 startPos = Vector2.zero; Vector2 pos = Vector2.zero; protected override int GetRequiredFingerCount() { return RequiredFingerCount; } /// /// Initial finger(s) position /// public Vector2 StartPosition { get { return startPos; } protected set { startPos = value; } } /// /// Current finger(s) position /// public Vector2 Position { get { return pos; } protected set { pos = value; } } }