123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- namespace ChivaXR.VR
- {
- using UnityEngine;
- #region 按键枚举
- public enum CVR_ButtonPressTypes
- {
- /// <summary>
- /// The button is currently being pressed.
- /// </summary>
- Press,
- /// <summary>
- /// The button has just been pressed down.
- /// </summary>
- PressDown,
- /// <summary>
- /// The button has just been released.
- /// </summary>
- PressUp,
- /// <summary>
- /// The button is currently being touched.
- /// </summary>
- Touch,
- /// <summary>
- /// The button has just been touched.
- /// </summary>
- TouchDown,
- /// <summary>
- /// The button is no longer being touched.
- /// </summary>
- TouchUp
- }
- public enum CVR_ButtonTypes
- {
- /// <summary>
- /// Button One on the controller.
- /// </summary>
- ButtonOne,
- /// <summary>
- /// Button Two on the controller.
- /// </summary>
- ButtonTwo,
- /// <summary>
- /// Grip on the controller.
- /// </summary>
- Grip,
- /// <summary>
- /// Grip Hairline on the controller.
- /// </summary>
- GripHairline,
- /// <summary>
- /// Start Menu on the controller.
- /// </summary>
- StartMenu,
- /// <summary>
- /// Trigger on the controller.
- /// </summary>
- Trigger,
- /// <summary>
- /// Trigger Hairline on the controller.
- /// </summary>
- TriggerHairline,
- /// <summary>
- /// Touchpad on the controller.
- /// </summary>
- Touchpad,
- /// <summary>
- /// Touchpad Two on the controller.
- /// </summary>
- TouchpadTwo,
- /// <summary>
- /// Middle Finger on the controller.
- /// </summary>
- MiddleFinger,
- /// <summary>
- /// Ring Finger on the controller.
- /// </summary>
- RingFinger,
- /// <summary>
- /// Pinky Finger on the controller.
- /// </summary>
- PinkyFinger
- }
- /// <summary>
- /// Controller hand reference.
- /// </summary>
- public enum CVR_ControllerHand
- {
- /// <summary>
- /// No hand is assigned.
- /// </summary>
- None,
- /// <summary>
- /// The left hand is assigned.
- /// </summary>
- Left,
- /// <summary>
- /// The right hand is assigned.
- /// </summary>
- Right
- }
- #endregion
- /// <summary>
- /// CVR交互接口(ChivaVR)
- /// </summary>
- public interface IVR_Interactable
- {
- /// <summary>
- /// 工具类型
- /// </summary>
- /// <returns></returns>
- CVR_ToolType GetToolType();
- /// <summary>
- /// 是否处于抓取状态
- /// </summary>
- /// <returns></returns>
- bool CVR_IsGrabbed();
- /// <summary>
- /// 是否处于使用状态
- /// </summary>
- /// <returns></returns>
- bool CVR_IsUsing();
- /// <summary>
- /// 断开使用状态
- /// </summary>
- /// <returns></returns>
- void ForceStopUsing();
- /// <summary>
- /// 获取当前手柄手部类型(左右)
- /// </summary>
- /// <returns></returns>
- CVR_ControllerHand CVR_GetCurrentHand();
- /// <summary>
- /// 检测手柄按钮状态
- /// </summary>
- /// <param name="btnType"></param>
- /// <param name="pressType"></param>
- /// <returns></returns>
- bool CVR_CheckButtonState(CVR_ButtonTypes btnType, CVR_ButtonPressTypes pressType);
- Vector2 CVR_GetControllerAxis(CVR_ButtonTypes btnType);
- /// <summary>
- /// 获取当前手部脚本Object
- /// </summary>
- /// <returns></returns>
- GameObject CVR_GetInteractableObject();
- /// <summary>
- /// 获取当前物体GameObject
- /// </summary>
- /// <returns></returns>
- GameObject CVR_GetCurrentObject();
- /// <summary>
- /// 获取VR摄像机
- /// </summary>
- /// <returns></returns>
- GameObject CVR_GetHeadsetCamera();
- /// <summary>
- /// 当前物体被拾取时
- /// </summary>
- event CVR_InteractableObjectEventHandler CVR_InteractableObjectGrabbed;
- /// <summary>
- /// 当前物体松手前
- /// </summary>
- event CVR_InteractableObjectEventHandler CVR_InteractableObjectPreUnGrabbed;
- /// <summary>
- /// 当前物体点击使用时
- /// </summary>
- event CVR_InteractableObjectEventHandler CVR_InteractableObjectUsed;
- /// <summary>
- /// 当前物体退出使用时
- /// </summary>
- event CVR_InteractableObjectEventHandler CVR_InteractableObjectUnused;
- }
- public struct CVR_InteractableObjectEventArgs
- {
- public GameObject interactingObject;
- }
- /// <summary>
- /// Event Payload
- /// </summary>
- /// <param name="sender">this object</param>
- /// <param name="e"><see cref="InteractableObjectEventArgs"/></param>
- public delegate void CVR_InteractableObjectEventHandler(object sender, CVR_InteractableObjectEventArgs e);
- }
|