using UnityEngine;
using System.Collections;
///
/// Base class for any FingerGestures component
/// Its main task is to fire off OnUpdate() after the FingerGestures.Fingers have been updated during this frame.
///
public abstract class FGComponent : MonoBehaviour
{
///
/// Generic delegate for GestureRecognizer events
///
/// The object that triggered this event
public delegate void EventDelegate( T source ) where T : FGComponent;
protected virtual void Awake()
{
// made virtual in case of furture usage
}
protected virtual void Start()
{
// made virtual in case of furture usage
}
protected virtual void OnEnable()
{
FingerGestures.OnFingersUpdated += FingerGestures_OnFingersUpdated;
}
protected virtual void OnDisable()
{
FingerGestures.OnFingersUpdated -= FingerGestures_OnFingersUpdated;
}
void FingerGestures_OnFingersUpdated()
{
OnUpdate( FingerGestures.Touches );
}
///
/// This is called after FingerGestures has updated the state of each finger
///
/// The list of fingers currently down / touching the screen
protected abstract void OnUpdate( FingerGestures.IFingerList touches );
}