123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- 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
- /// <summary>
- /// 超过noise算一次有效运动
- /// </summary>
- protected float noise = 0.016f;
- /// <summary>
- /// 几次有效运动算一个Event
- /// </summary>
- protected int effect = 3;
- /// <summary>
- /// 多久采样一次是否有超过noise的有效运动,0.1f表示0.1s
- /// </summary>
- protected float samplingTime = 0.05f;
- ///-----------------------------算法使用的参数-----End
- /// <summary>
- /// 当前的Event状态
- /// </summary>
- public static HandEventDelegate eventDelegate;
- public float EventPercent = 0;
- public HandEventType currentEvent = HandEventType.Null;
- protected HandEventType previousEvent = HandEventType.Null;
- public bool eventfromdriver = false;
- /// <summary>
- /// 派发Event到委托
- /// </summary>
- 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() {
-
- }
- }
- }
|