public void OnSelectPressedAmountChanged(SelectPressedEventData eventData) { if (Slam.Instance.Handdraggable == null) { if (eventData.PressedAmount > 0.8) { if (eventData.currentInputModule != null && eventData.currentInputModule.transform != null) { if (eventData.InputSource is InteractionInputSource) { InteractionInputSource gis = (InteractionInputSource)eventData.InputSource; var sdata = gis.transform; Slam.Instance.SetHandDraggable(GetactiveTransform(), gis, eventData.SourceId, IsHandDragable, IsHandRotatable); } } } else if (eventData.PressedAmount < 0.3) { Slam.Instance.Handdraggable = null; } } else { Slam.Instance.Handdraggable = null; } }
void IInputHandler.OnInputUp(InputEventData eventData) { InteractionInputSource inputSource = eventData.InputSource as InteractionInputSource; if (inputSource != null) { if (eventData.PressType == InteractionSourcePressInfo.Grasp) { inputSource.StopHaptics(eventData.SourceId); } } }
public void OnInputClicked(InputClickedEventData eventData) { if (spawnedObject.activeSelf) { spawnedObject.SetActive(false); hideThisObject.SetActive(true); } else { spawnedObject.SetActive(true); if (updateSolverTargetToClickSource && solverHandler != null) { InteractionInputSource interactionInputSource = eventData.InputSource as InteractionInputSource; if (interactionInputSource != null) { InteractionSourceInfo sourceKind; if (interactionInputSource.TryGetSourceKind(eventData.SourceId, out sourceKind)) { switch (sourceKind) { case InteractionSourceInfo.Controller: Handedness handedness; if (interactionInputSource.TryGetHandedness(eventData.SourceId, out handedness)) { if (handedness == Handedness.Right) { solverHandler.TrackedObjectToReference = SolverHandler.TrackedObjectToReferenceEnum.MotionControllerRight; } else { solverHandler.TrackedObjectToReference = SolverHandler.TrackedObjectToReferenceEnum.MotionControllerLeft; } } break; default: Debug.LogError("The click event came from a device that isn't tracked. Nothing to attach to! Use a controller to select an example."); break; } } } } hideThisObject.SetActive(false); } eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers. }
// Use this for initialization void Start() { gestureSource = GameObject.FindObjectOfType <InteractionInputSource>(); mouseButtonController = GameObject.FindObjectOfType <ButtonController>(); bcType = mouseButtonController.buttonType; EventManager.StartListening("OwnTurn", HandleOwnTurnStart); EventManager.StartListening("EnemyTurn", HandleEnemyTurnStart); EventManager.StartListening("Win", HandleWin); EventManager.StartListening("Loss", HandleLoss); EventManager.StartListening("Draw", HandleDraw); if (isServer) { turnPlayerId = PickFirstPlayer(); } }
void IInputHandler.OnInputDown(InputEventData eventData) { InteractionInputSource inputSource = eventData.InputSource as InteractionInputSource; if (inputSource != null) { switch (eventData.PressType) { case InteractionSourcePressInfo.Grasp: inputSource.StartHaptics(eventData.SourceId, 1.0f); return; case InteractionSourcePressInfo.Menu: inputSource.StartHaptics(eventData.SourceId, 1.0f, 1.0f); return; } } }