Exemple #1
0
        private void Start()
        {
            cubeToMove = TransitionManager.Instance.ViewVolume.GetComponentInChildren <PlacementControl>();

            if (TooltipObject != null)
            {
                TooltipObject.SetActive(false);
            }
        }
        private void Start()
        {
            placementControl = TransitionManager.Instance.ViewVolume.GetComponentInChildren <PlacementControl>();

            if (placementControl != null)
            {
                placementControl.ContentHeld   += PlacementControl_ContentHeld;
                placementControl.ContentPlaced += PlacementControl_ContentPlaced;
            }

            if (TransitionManager.Instance != null)
            {
                TransitionManager.Instance.ResetStarted += ResetStarted;
            }
        }
        private void CoreSystemsLoaded()
        {
            ViewLoader.Instance.CoreSystemsLoaded -= CoreSystemsLoaded;
            InputRouter.Instance.InputTapped      += OnTapped;
            coreSystemsLoaded = true;

            placementControl = TransitionManager.Instance.ViewVolume.GetComponentInChildren <PlacementControl>();

            MusicManager.Instance.FindSnapshotAndTransition(MusicManager.Instance.Welcome);
            VOManager.Instance.Stop(clearQueue: true);
            //VOManager.Instance.PlayClip(Title);
            //VOManager.Instance.PlayClip(Description);
            //VOManager.Instance.PlayClip(Goal);
            //VOManager.Instance.PlayClip(Invitation);

            UpdateInstructions();
        }
Exemple #4
0
        // Find top parent entity of new scene that is loaded
        private GameObject FindContent()
        {
            TransformHandler[] parentContent = FindObjectsOfType <TransformHandler>();
            foreach (var parent in parentContent)
            {
                if (parent.gameObject != prevSceneLoaded)
                {
                    return(parent.gameObject);
                }
            }

            // if the scene didn't have an object with at TransformHandler, we are
            // in the initial placmenet mode. Look for that script instead.
            PlacementControl placement = FindObjectOfType <PlacementControl>();

            return(placement?.gameObject);
        }
Exemple #5
0
        private void Start()
        {
            if (Camera.main == null)
            {
                Debug.LogError(" GazeSelection:No main camera exists in the scene, unable to use GazeSelection.", this);
                GameObject.Destroy(this);
                return;
            }

            if (Cursor.Instance == null)
            {
                Debug.LogError("GazeSelection: no target layer masks can be used because the Cursor was not found.", this);
                GameObject.Destroy(this);
                return;
            }

            if (TransitionManager.Instance == null)
            {
                Debug.LogWarning("GazeSelection: No TransitionManager found, so input is not disabled during transitions.");
            }
            else if (TransitionManager.Instance.ViewVolume != null)
            {
                placementControl = TransitionManager.Instance.ViewVolume.GetComponentInChildren <PlacementControl>();
            }

            selectedTargets = new SortedList <float, RaycastHit>();

            if (MyAppPlatformManager.Platform == MyAppPlatformManager.PlatformId.ImmersiveHMD &&
                GazeSpreadDegrees < 10f)
            {
                GazeSpreadDegrees = 10f;
            }

            targetSpreadMinValue = Mathf.Cos(Mathf.Deg2Rad * GazeSpreadDegrees);

            if (!UnityEngine.XR.XRDevice.isPresent)
            {
#if !UNITY_EDITOR
                // Unity 2017.2.0b8 changed something. Commenting out this line
                // allows you to select things other than the center of the
                // galaxy using the mouse in a 2d Xaml app running on a desktop
                //UseSphericalConeSearch = false;
#endif
            }
        }
Exemple #6
0
        private IEnumerator Initialization()
        {
            // ViewLoader of CoreSystems scene needs to be loaded and then continue
            yield return(new WaitUntil(() => FindObjectOfType <ViewLoader>() != null));

            // need to wait otherwise the viewloader subscription to callback becomes null in holoLens
            //yield return new WaitForSeconds(1);
            yield return(new WaitForEndOfFrame());

            audioService = MixedRealityToolkit.Instance.GetService <IAudioService>();

            PlacementControl placement = FindObjectOfType <PlacementControl>();

            if (placement)
            {
                placement.OnContentPlaced += OnPlacementFinished;
            }

            if (viewLoaderScript == null)
            {
                viewLoaderScript = GalaxyExplorerManager.Instance.ViewLoaderScript;
                if (viewLoaderScript)
                {
                    viewLoaderScript.OnSceneIsLoaded += OnSceneIsLoaded;
                }
            }

            if (flowManagerScript == null)
            {
                flowManagerScript = GalaxyExplorerManager.Instance.FlowManagerHandler;
                if (flowManagerScript)
                {
                    flowManagerScript.enabled            = true;
                    flowManagerScript.OnStageTransition += OnStageTransition;
                }
            }

            StartCoroutine(PlayWelcomeMusic());

            yield return(null);
        }
Exemple #7
0
        public void InternalHandleOnTapped()
        {
            if (TransitionManager.Instance != null && !TransitionManager.Instance.InTransition)
            {
                bool handled = false;
                if (GazeSelectionManager.Instance && GazeSelectionManager.Instance.SelectedTarget)
                {
                    handled = GazeSelectionManager.Instance.SelectedTarget.OnTapped();
                }
                else
                {
                    PlacementControl placementControl = TransitionManager.Instance.ViewVolume.GetComponentInChildren <PlacementControl>();

                    if (placementControl != null && placementControl.IsHolding)
                    {
                        handled = placementControl.OnTapped();
                        if (ToolSounds.isInitialized &&         // Starts out on an inactive object so Instance will be null
                            ToolSounds.Instance &&              // Make sure we have an instance
                            ToolManager.Instance &&             // Make sure we have an instance
                            ToolManager.Instance.ToolsVisible)  // Can we start a Co-routine on this object?
                        {
                            ToolSounds.Instance.PlaySelectSound();
                        }
                    }
                }

                if (!handled && InputTapped != null)
                {
                    InputTapped();
                }

                if (Tapped != null)
                {
                    Tapped();
                }
            }
        }