public override void pb_Start() { m_ShapeBounds = ObjectUtils.CreateGameObjectWithComponent <SelectionBoundsModule>(); m_AudioModule = ObjectUtils.CreateGameObjectWithComponent <VRAudioModule>(); m_GridModule = ObjectUtils.CreateGameObjectWithComponent <GridModule>(); m_GuideModule = ObjectUtils.CreateGameObjectWithComponent <GuideModule>(); m_GridModule.SetVisible(false); m_ProxyRay = ObjectUtils.Instantiate(m_ProxyRayPrefab.gameObject).GetComponent <DefaultProxyRay>(); m_ProxyRay.transform.position = Vector3.zero; m_ProxyRay.transform.localRotation = Quaternion.identity; m_ProxyRay.transform.SetParent(rayOrigin, false); //this.HideDefaultRay(rayOrigin); //this.LockRay(rayOrigin, this); }
private void ConnectInterfaces(object obj, InputDevice device = null) { var mainMenu = obj as IMainMenu; if (device != null) { var ray = obj as IRay; if (ray != null) { foreach (var proxy in m_AllProxies) { if (!proxy.active) { continue; } var node = GetDeviceNode(device); if (node.HasValue) { bool continueSearching = true; Transform rayOrigin; if (proxy.rayOrigins.TryGetValue(node.Value, out rayOrigin)) { ray.rayOrigin = rayOrigin; // Specific proxy ray setting DefaultProxyRay dpr = null; var customRay = obj as ICustomRay; if (customRay != null) { dpr = rayOrigin.GetComponentInChildren <DefaultProxyRay>(); customRay.showDefaultRay = dpr.Show; customRay.hideDefaultRay = dpr.Hide; } var lockableRay = obj as ILockRay; if (lockableRay != null) { dpr = dpr ?? rayOrigin.GetComponentInChildren <DefaultProxyRay>(); lockableRay.lockRay = dpr.LockRay; lockableRay.unlockRay = dpr.UnlockRay; } continueSearching = false; } if (mainMenu != null) { Transform mainMenuOrigin; if (proxy.menuOrigins.TryGetValue(node.Value, out mainMenuOrigin)) { mainMenu.menuOrigin = mainMenuOrigin; Transform alternateMenuOrigin; if (proxy.alternateMenuOrigins.TryGetValue(node.Value, out alternateMenuOrigin)) { mainMenu.alternateMenuOrigin = alternateMenuOrigin; } } } if (!continueSearching) { break; } } } } } var locomotion = obj as ILocomotion; if (locomotion != null) { locomotion.viewerPivot = VRView.viewerPivot; } var instantiateUI = obj as IInstantiateUI; if (instantiateUI != null) { instantiateUI.instantiateUI = InstantiateUI; } var raycaster = obj as IRaycaster; if (raycaster != null) { raycaster.getFirstGameObject = GetFirstGameObject; } var highlight = obj as IHighlight; if (highlight != null) { highlight.setHighlight = m_HighlightModule.SetHighlight; } var placeObjects = obj as IPlaceObjects; if (placeObjects != null) { placeObjects.placeObject = PlaceObject; } var positionPreview = obj as IPositionPreview; if (positionPreview != null) { positionPreview.positionPreview = m_ObjectPlacementModule.PositionPreview; positionPreview.getPreviewOriginForRayOrigin = GetPreviewOriginForRayOrigin; } var selectionChanged = obj as ISelectionChanged; if (selectionChanged != null) { m_SelectionChanged += selectionChanged.OnSelectionChanged; } if (mainMenu != null) { mainMenu.menuTools = m_AllTools.ToList(); mainMenu.selectTool = SelectTool; mainMenu.menuWorkspaces = m_AllWorkspaceTypes.ToList(); mainMenu.createWorkspace = CreateWorkspace; mainMenu.node = GetDeviceNode(device); mainMenu.setup(); } }