protected override void Start() { if (handController == null) { #if CP_ORION // handController = CPUtil.FindComponent<LeapHandController>("LeapHandController"); // leapProvider = CPUtil.FindComponent<LeapProvider>("LeapHandController"); var leapServiceProvider = CPUtil.FindComponent <LeapServiceProvider>("LeapHandController"); leapProvider = (LeapProvider)leapServiceProvider; handController = leapServiceProvider.GetLeapController(); #else handController = CPUtil.FindComponent <HandController>("HandController"); #endif } #if CP_ORION if (leapProvider == null) { leapProvider = CPUtil.FindComponent <LeapProvider>("LeapHandController"); } #endif if (handController == null // || !handController.enabled ) { Debug.Log("Disabling."); enabled = false; return; } #if CP_ORION lastProcessedFrame = leapProvider.CurrentFrame; #else lastProcessedFrame = handController.GetFrame(); #endif base.Start(); #if !CP_ORION /* Orion doesn't have gestures yet. */ if (enableScreenTap) { handController.GetLeapController().EnableGesture(Gesture.GestureType.TYPE_SCREEN_TAP); SetFloat("Gesture.ScreenTap.MinForwardVelocity", screenTapParams.minVelocity); SetFloat("Gesture.ScreenTap.HistorySeconds", screenTapParams.historySeconds); SetFloat("Gesture.ScreenTap.MinDistance", screenTapParams.minDistance); } if (enableKeyTap) { handController.GetLeapController().EnableGesture(Gesture.GestureType.TYPE_KEY_TAP); SetFloat("Gesture.KeyTap.MinForwardVelocity", keyTapParams.minVelocity); SetFloat("Gesture.KeyTap.HistorySeconds", keyTapParams.historySeconds); SetFloat("Gesture.KeyTap.MinDistance", keyTapParams.minDistance); } if (!handController.GetLeapController().Config.Save()) { Debug.Log("Not able to save Leap Motion Controller config settings to service."); } #endif // !CP_ORION }
protected void OnEnable() { if (module == null) { module = CPUtil.FindComponent <TransformPointerModule>("EventSystem"); if (module == null) { Debug.Log("Disabling."); enabled = false; return; } } pointerId = module.GetNextPointerId(pointerId); Register(); }
void Start() { #if CP_HAVE_LEAPMOTION foreach (var go in activateTheseIfLeapMotionDisabled) { go.SetActive(false); } #else var input = CPUtil.FindComponent <StandaloneInputModule>("EventSystem"); if (input != null) { input.enabled = true; } foreach (var go in activateTheseIfLeapMotionDisabled) { go.SetActive(true); } #endif }