/// <summary> /// Drops the provided intent object, returning it to the intention system. You must /// pass a valid intention object in by reference; upon calling this method, your /// reference to the object will be nullified. /// </summary> public static void Drop(ref UserIntent intent) { if (intent == null) { return; } switch (intent.definition.type) { case IntentionType.BothHands: _bothHandIntention = intent; intent = null; break; case IntentionType.SingleHand: if (intent.GetHandedness() == Chirality.Left) { _leftHandIntention = intent; intent = null; } else { _rightHandIntention = intent; intent = null; } break; } }
public static bool TryReceive(IntentDefinition intent, out UserIntent intentObject) { intentObject = null; switch (intent.type) { case IntentionType.SingleHand: if (intent.handedness == Chirality.Left) { if (_leftHandIntention != null && _bothHandIntention != null) { intentObject = _leftHandIntention; _leftHandIntention = null; return(true); } else { return(false); } } else { if (_rightHandIntention != null && _bothHandIntention != null) { intentObject = _rightHandIntention; _rightHandIntention = null; return(true); } else { return(false); } } case IntentionType.BothHands: if (_leftHandIntention != null && _rightHandIntention != null && _bothHandIntention != null) { intentObject = _bothHandIntention; _bothHandIntention = null; return(true); } else { return(false); } default: return(false); } }