10 #if UNITY_WSA || UNITY_STANDALONE_WIN 31 private uint mCurrentInputSourceId;
33 [Tooltip(
"Sets the time before the gesture starts after a press has occurred, handy when a select event is also being used")]
36 [Tooltip(
"The GestureInteractiveControl to send gesture updates to")]
42 [Tooltip(
"Should this control hide the cursor during this manipulation?")]
48 private Vector3 mStartHeadPosition;
49 private Vector3 mStartHeadRay;
50 private Vector3 mStartHandPosition;
51 private Vector3 mCurrentHandPosition;
54 private Coroutine mTicker;
56 private uint mTempInputSourceId;
66 Control = GetComponent<GestureInteractiveControl>();
84 base.OnInputDown(eventData);
87 mTempInputSourceId = eventData.
SourceId;
93 mTicker = StartCoroutine(Ticker(StartDelay));
117 gesture.HandleRelease(
false);
118 gesture.CleanUpTicker();
121 private IEnumerator Ticker(
float seconds)
123 yield
return new WaitForSeconds(seconds);
124 HandleStartGesture();
130 private void HandleStartGesture()
137 mCurrentInputSource = mTempInputSource;
138 mCurrentInputSourceId = mTempInputSourceId;
143 Vector3 handPosition;
146 mStartHandPosition = handPosition;
147 mCurrentHandPosition = handPosition;
159 if (mCurrentInputSource != null && (eventData == null || eventData.
SourceId == mCurrentInputSourceId))
161 HandleRelease(
false);
182 if (mCurrentInputSource != null && eventData.
SourceId == mCurrentInputSourceId)
193 private void CleanUpTicker()
197 StopCoroutine(mTicker);
205 private void HandleRelease(
bool lost)
207 mTempInputSource = null;
209 Vector3 handPosition = GetCurrentHandPosition();
211 mCurrentHandPosition = handPosition;
214 mCurrentHandPosition,
223 base.OnInputUp(null);
227 base.OnInputUp(null);
231 mCurrentInputSource = null;
242 if (mCurrentInputSource == null)
253 if (mCurrentInputSource == null)
263 private Vector3 GetCurrentHandPosition()
265 Vector3 handPosition;
266 #if UNITY_2017_2_OR_NEWER 278 private void HandleCursor(
bool state)
284 mCursor = FindObjectOfType<Cursor>();
287 if (HideCursorOnManipulation && mCursor != null)
300 if (mCurrentInputSource != null)
302 mCurrentHandPosition = GetCurrentHandPosition();
307 #if UNITY_WSA || UNITY_STANDALONE_WIN 308 protected override void KeywordRecognizer_OnPhraseRecognized(PhraseRecognizedEventArgs args)
315 base.KeywordRecognizer_OnPhraseRecognized(args);
318 if ((!KeywordRequiresGaze || HasGaze) && mKeywordDictionary != null)
321 if (mKeywordDictionary.TryGetValue(args.text, out index))
336 StopCoroutine(mTicker);