void processGestureInMenuSelection(TouchGestureRecognizer.TouchGesture touchGesture) { if (touchGesture.GestureType == TouchGestureRecognizer.TouchGestureType.SINGLE_TOUCH_DOWN) { TouchPointerData touchData = (TouchPointerData)touchGesture.MetaData; Vector2 rawLocalTapPos = new Vector2(touchData.RelX, touchData.RelY); Vector2 adjustedLocalTapPos = GlobalUtilities.ConvertMobileRelPosToUnityRelPos(rawLocalTapPos); if (menuManipLocalBound.Contains(adjustedLocalTapPos)) { _menuManip.GetComponent <MeshRenderer>().material = menuMaterials[1]; } else if (menuDrawLocalBound.Contains(adjustedLocalTapPos)) { _menuDraw.GetComponent <MeshRenderer>().material = menuMaterials[3]; } } else if (touchGesture.GestureType == TouchGestureRecognizer.TouchGestureType.SINGLE_TAP) { Vector2 rawLocalTapPos = (Vector2)touchGesture.MetaData; Vector2 adjustedLocalTapPos = GlobalUtilities.ConvertMobileRelPosToUnityRelPos(rawLocalTapPos); if (menuManipLocalBound.Contains(adjustedLocalTapPos)) { setMenuItemActive(false); _currentState = VirtualPadState.OBJECT_MANIP; } else if (menuDrawLocalBound.Contains(adjustedLocalTapPos)) { setMenuItemActive(false); _currentState = VirtualPadState.DRAW; } } }
void processGestureInDrawMode(TouchGestureRecognizer.TouchGesture touchGesture) { if (touchGesture.GestureType == TouchGestureRecognizer.TouchGestureType.FIVE_POINTERS) { setMenuItemActive(true); _currentState = VirtualPadState.MENU_SELECTION; } }
public void ReactToTouchGesture(TouchGestureRecognizer.TouchGesture touchGesture) { if (touchGesture == null) { return; } if (_currentState == VirtualPadState.OBJECT_MANIP) { processGestureInObjectManipMode(touchGesture); } else if (_currentState == VirtualPadState.DRAW) { processGestureInDrawMode(touchGesture); } else { processGestureInMenuSelection(touchGesture); } }