using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
namespace SC.XR.Unity.Module_InputSystem.InputDeviceHand {
public abstract class InputDeviceHandPartEventBase : InputDevicePartEventBase {
public InputDevicePartDispatchEventHand inputDevicePartDispatchEventHand;
public InputDeviceHandPartEventBase(InputDevicePartDispatchEventHand inputDevicePartDispatchEventHand) : base(inputDevicePartDispatchEventHand) {
this.inputDevicePartDispatchEventHand = inputDevicePartDispatchEventHand;
inputDeviceHandPart = this.inputDevicePartDispatchEventHand.inputDeviceHandPart;
handInfo = this.inputDevicePartDispatchEventHand.inputDeviceHandPart.inputDataHand.handInfo;
}
protected handInfo handInfo;
protected InputDeviceHandPart inputDeviceHandPart;
///-----------------------------算法使用的参数-----start
///
/// 超过noise算一次有效运动
///
protected float noise = 0.016f;
///
/// 几次有效运动算一个Event
///
protected int effect = 3;
///
/// 多久采样一次是否有超过noise的有效运动,0.1f表示0.1s
///
protected float samplingTime = 0.05f;
///-----------------------------算法使用的参数-----End
///
/// 当前的Event状态
///
public static HandEventDelegate eventDelegate;
public float EventPercent = 0;
public HandEventType currentEvent = HandEventType.Null;
protected HandEventType previousEvent = HandEventType.Null;
public bool eventfromdriver = false;
///
/// 派发Event到委托
///
protected override void DispatchEventDelegate() {
if(eventDelegate == null || currentEvent == HandEventType.Null) {
return;
}
//DebugMy.Log(inputDeviceHandPart.PartType+" DispatchEventDelegate -----> " + currentEvent , this,true);
eventDelegate(inputDeviceHandPart, currentEvent, EventPercent);
}
protected override void DispatchEventTarget() {
}
}
}