using System; using UnityEngine; namespace Leap.Unity { public abstract class HandTransitionBehavior : MonoBehaviour { protected abstract void HandReset(); protected abstract void HandFinish(); protected virtual void Awake() { this.iHandModel = base.GetComponent(); if (this.iHandModel == null) { Debug.LogWarning("HandTransitionBehavior components require an IHandModel component attached to the same GameObject"); return; } this.iHandModel.OnBegin += this.HandReset; this.iHandModel.OnFinish += this.HandFinish; } protected virtual void OnDestroy() { IHandModel component = base.GetComponent(); if (component == null) { Debug.LogWarning("HandTransitionBehavior components require an IHandModel component attached to the same GameObject"); return; } component.OnBegin -= this.HandReset; component.OnFinish -= this.HandFinish; } protected IHandModel iHandModel; } }