using System;
using System.Diagnostics;
using UnityEngine;

namespace Leap.Unity
{
	[ExecuteInEditMode]
	public abstract class IHandModel : MonoBehaviour
	{
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		public event Action OnBegin;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		public event Action OnFinish;

		public bool IsTracked
		{
			get
			{
				return this.isTracked;
			}
		}

		public abstract Chirality Handedness { get; set; }

		public abstract ModelType HandModelType { get; }

		public virtual void InitHand()
		{
		}

		public virtual void BeginHand()
		{
			if (this.OnBegin != null)
			{
				this.OnBegin();
			}
			this.isTracked = true;
		}

		public abstract void UpdateHand();

		public virtual void FinishHand()
		{
			if (this.OnFinish != null)
			{
				this.OnFinish();
			}
			this.isTracked = false;
		}

		public abstract Hand GetLeapHand();

		public abstract void SetLeapHand(Hand hand);

		public virtual bool SupportsEditorPersistence()
		{
			return false;
		}

		private bool isTracked;
	}
}
