1234567891011121314151617181920212223242526272829303132333435363738 |
- 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<IHandModel>();
- 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<IHandModel>();
- 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;
- }
- }
|