1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using UnityEngine;
- using UnityEngine.EventSystems;
- namespace Rokid.UXR.Interaction
- {
- public class GesturePinchInput : BaseInput
- {
- public override bool mousePresent => true;
- public override Vector2 mousePosition => GetGesPosition();
- public override bool touchSupported => true;
- public override int touchCount => 0;
- private bool mouseActive = false;
- public HandType hand = HandType.None;
- public void SetHandType(HandType hand)
- {
- this.hand = hand;
- }
- protected override void Awake()
- {
- base.Awake();
- }
- protected override void OnDestroy()
- {
- base.OnDestroy();
- }
- public override bool GetMouseButtonDown(int button)
- {
- return GesEventInput.Instance.GetHandDown(hand, true);
- }
- public override bool GetMouseButtonUp(int button)
- {
- return GesEventInput.Instance.GetHandUp(hand, true);
- }
- public override bool GetMouseButton(int button)
- {
- return GesEventInput.Instance.GetHandPress(hand, true);
- }
- public Vector2 GetGesPosition()
- {
- Vector2 gesPos = Vector2.zero;
- Gesture gesture = GesEventInput.Instance.GetGesture(hand);
- if (gesture != null)
- {
- gesPos = gesture.position;
- }
- return gesPos;
- }
- }
- }
|