Example #1
0
        public virtual void OnCalibrationResult(CalibrationResult calibResult)
        {
            // Dispatch to Unity main thread
            _Dispatcher.Dispatch(() =>
            {
                Debug.Log("OnCalibrationResult: result: " + calibResult.Result + ", Avg error: " + calibResult.AverageErrorDegree);

                //Should we resample?
                if (!calibResult.Result)
                {
                    //Evaluate results
                    foreach (var calPoint in calibResult.Calibpoints)
                    {
                        if (calPoint.State == CalibrationPoint.STATE_RESAMPLE || calPoint.State == CalibrationPoint.STATE_NO_DATA)
                        {
                            _CalibrationPoints.Add(new Point2D(calPoint.Coordinates.X, calPoint.Coordinates.Y));
                        }
                    }

                    //Should we abort?
                    if (_ResampleCount++ >= NUM_MAX_CALIBRATION_ATTEMPTS || _CalibrationPoints.Count == 0 || _CalibrationPoints.Count >= NUM_MAX_RESAMPLE_POINTS)
                    {
                        _CalibrationPoints.Clear();
                        GazeManager.Instance.CalibrationAbort();

                        StartCoroutine(_CalibUIRemoteFader.InteruptAndFadeIn());

                        Debug.Log("Calibration FAIL");
                    }
                    else
                    {
                        Invoke("ShowNextCalibrationPoint", CALIB_SHOW_NEXT_POINT_DELAY);
                    }
                }
                else
                {
                    if (calibResult.AverageErrorDegree < 1.5)
                    {
                        Debug.Log("Calibration SUCCESS");

                        LoadNextScene();
                    }
                    else
                    {
                        _CalibrationPoints.Clear();
                        GazeManager.Instance.CalibrationAbort();

                        StartCoroutine(_CalibUIRemoteFader.InteruptAndFadeIn());

                        Debug.Log("Calibration FAIL");
                    }
                }
            });
        }
        public void StartCalibration()
        {
            if (!GazeManager.Instance.IsCalibrating)
            {
                _QualityText.enabled = false;
                _InfoText.text       = "\n\nFollow the <b>Calibration Point</b>";

                StartCoroutine(_CalibUIFader.InteruptAndFadeIn());

                Invoke("DelayedShowCalibPoint", CALIB_INTRO_DELAY * .5f);

                Invoke("CallCalibrationStart", CALIB_INTRO_DELAY);
            }
        }
Example #3
0
        private void ToggleDebug(bool isDebug)
        {
            if (isDebug)
            {
                StartCoroutine(_GazeCoordUpdater = GazeCoordUpdater());
                StartCoroutine(_GameFPSUpdater   = GameFPSUpdater());
                StartCoroutine(_GazeFPSUpdater   = GazeFPSUpdater());
            }
            else
            {
                if (null != _GazeCoordUpdater)
                {
                    StopCoroutine(_GazeCoordUpdater);
                }
                if (null != _GameFPSUpdater)
                {
                    StopCoroutine(_GameFPSUpdater);
                }
                if (null != _GazeFPSUpdater)
                {
                    StopCoroutine(_GazeFPSUpdater);
                }
            }

            if (isDebug)
            {
                StartCoroutine(_UiFader.InteruptAndFadeIn());
            }
            else
            {
                StartCoroutine(_UiFader.InteruptAndFadeOut());
            }
        }
Example #4
0
        private IEnumerator Start()
        {
            m_Reticle.Show();

            m_Radial.Hide();

            // In order, fade in the UI on how to use sliders, wait for the slider to be filled then fade out the UI.
            yield return(StartCoroutine(m_HowToUseFader.InteruptAndFadeIn()));

            yield return(StartCoroutine(m_HowToUseSlider.WaitForBarToFill()));

            yield return(StartCoroutine(m_HowToUseFader.InteruptAndFadeOut()));

            yield return(StartCoroutine(m_CameraMovement.GameStart())); //move camera to right position and start shooting the ball

            // In order, fade in the UI on confirming the use of sliders, wait for the slider to be filled, then fade out the UI.
            yield return(StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeIn()));

            while (true)
            {
                yield return(StartCoroutine(m_HowToUseConfirmSlider.WaitForBarToFill()));

                //yield return StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeOut());

                yield return(StartCoroutine(m_BallShooter.ShootBall()));
            }

            //// Fade in the final UI.
            //yield return StartCoroutine (m_ReturnFader.InteruptAndFadeIn ());
        }
Example #5
0
    public IEnumerator ShowOutroUI()
    {
        totalScore.text = SessionData.Score.ToString();//using VRStandardAssets.Common;
        highScore.text  = SessionData.HighScore.ToString();

        yield return(StartCoroutine(outroUI.InteruptAndFadeIn()));
    }
Example #6
0
    public IEnumerator ShowOutroUI()
    {
        //m_TotalScore.text = SessionData.Score.ToString();
        //m_HighScore.text = SessionData.HighScore.ToString();

        yield return(StartCoroutine(m_OutroUI.InteruptAndFadeIn()));
    }
        private IEnumerator ShowMenu(UIFader fader, SelectionSlider slider)
        {
            yield return(StartCoroutine(fader.InteruptAndFadeIn()));

            yield return(StartCoroutine(slider.WaitForBarToFill()));

            yield return(StartCoroutine(fader.InteruptAndFadeOut()));
        }
Example #8
0
    public IEnumerator Show()
    {
        StartCoroutine(m_CanvasFader.InteruptAndFadeIn());

        yield return(new WaitForSeconds(m_ToastTime));

        StartCoroutine(m_CanvasFader.InteruptAndFadeOut());
    }
 public IEnumerator ShowInfoUI()
 {
     // Default would be not commented
     // This is temporary because of requirements that
     // if a user see another animal, the user can select that animal
     // and the info will change.
     //Showing = true;
     yield return(StartCoroutine(m_InfoUI.InteruptAndFadeIn()));
 }
Example #10
0
        public IEnumerator ShowOutroUI()
        {
            // Set the text to show the various scores.
            m_TotalScore.text = SessionData.Score.ToString();
            m_HighScore.text  = SessionData.HighScore.ToString();

            // Wait for the outro to fade in.
            yield return(StartCoroutine(m_OutroUI.InteruptAndFadeIn()));
        }
Example #11
0
        private IEnumerator EndPhase()
        {
            // Turn off the ability to set targets for the character.
            m_MazeTargetSetting.Deactivate();

            // Hide the reticle as it's not required at the moment.
            m_Reticle.Hide();

            // The reticle also controls the rotation for the selection radial so set it to use default rotation.
            m_Reticle.UseNormal = false;

            // Hide the destination marker as targets are no longer being set.
            m_DestinationMarker.Hide();

            // If the player won...
            if (m_Win)
            {
                // ... play the win particles and audio.
                m_WinParticles.Play(true);
                m_GameOverAudioSource.Play();

                // Wait for the particles to finish.
                yield return(new WaitForSeconds(m_WinParticles.main.duration));

                // Wait for the win UI to fade in.
                yield return(StartCoroutine(m_WinFader.InteruptAndFadeIn()));
            }
            else
            {
                // If the player didn't win wait for the lose UI to fade in.
                yield return(StartCoroutine(m_LoseFader.InteruptAndFadeIn()));
            }

            // The user needs to hold Fire1 to pass the UI so turn on double tap warnings.
            m_InputWarnings.TurnOnDoubleTapWarnings();

            // Wait for the radial to fill.
            yield return(StartCoroutine(m_SelectionRadial.WaitForSelectionRadialToFill()));

            // Turn the tap warnings back off.
            m_InputWarnings.TurnOffDoubleTapWarnings();

            // In order wait for the win and lose UI to fade out (only one should be faded in) then wait for the camera to fade out.
            yield return(StartCoroutine(m_WinFader.InteruptAndFadeOut()));

            yield return(StartCoroutine(m_LoseFader.InteruptAndFadeOut()));

            yield return(StartCoroutine(m_CameraFade.BeginFadeOut(true)));

            // Restart all the dependent scripts.
            Restart();

            // Wait for the screen tot fade back in.
            yield return(StartCoroutine(m_CameraFade.BeginFadeIn(true)));
        }
        private IEnumerator ShowMenu(UIFader fader, VRTrackerTag tag)
        {
            yield return(StartCoroutine(fader.InteruptAndFadeIn()));

            yield return(StartCoroutine(tag.WaitForAssignation()));

            if (tag.IDisAssigned)
            {
                transform.GetComponent <AudioSource> ().Play();
            }
            yield return(StartCoroutine(fader.InteruptAndFadeOut()));
        }
Example #13
0
        public void StartCalibration()
        {
            if (!GazeManager.Instance.IsCalibrating)
            {
                _QualityText.enabled = false;
                _InfoText.text       = "\n\nFollow the <b>Calibration Point</b>";

                StartCoroutine(_CalibUIRemoteFader.InteruptAndFadeOut());

                StartCoroutine(_CalibUIFader.InteruptAndFadeIn());

                if (null != _EyeUI && _EyeUI.gameObject.activeInHierarchy)
                {
                    _EyeUI.TurnOff();
                }

                Invoke("DelayedShowCalibPoint", CALIB_INTRO_DELAY * .5f);

                Invoke("CallCalibrationStart", CALIB_INTRO_DELAY);
            }
        }
        private IEnumerator ShowMenu(UIFader fader, VRTrackerAssociation prefab)
        {
            yield return(StartCoroutine(fader.InteruptAndFadeIn()));

            prefab.WaitForAssignation();
            yield return(StartCoroutine(VRTrackerTagAssociation.instance.WaitForAssignation()));

            if (prefab.isIDAssigned)
            {
                transform.GetComponent <AudioSource> ().Play();
            }
            yield return(StartCoroutine(fader.InteruptAndFadeOut()));
        }
Example #15
0
    // Use this for initialization
    IEnumerator Start()
    {
        m_Reticle.Show();

        m_Radial.Hide();

        yield return(StartCoroutine(m_HowToUseFader.InteruptAndFadeIn()));

        yield return(StartCoroutine(m_HowToUseSlider.WaitForBarToFill()));

        yield return(StartCoroutine(m_HowToUseFader.InteruptAndFadeOut()));

        SceneManager.LoadScene("Start Menu");
    }
Example #16
0
        [SerializeField] private UIFader m_ReturnFader;                     // The final instructions are controlled using this fader.


        private IEnumerator Start()
        {
            m_Reticle.Show();

            m_Radial.Hide();

            // In order, fade in the UI on how to use sliders, wait for the slider to be filled then fade out the UI.
            yield return(StartCoroutine(m_HowToUseFader.InteruptAndFadeIn()));

            yield return(StartCoroutine(m_HowToUseSlider.WaitForBarToFill()));

            yield return(StartCoroutine(m_HowToUseFader.InteruptAndFadeOut()));

            // Fade in the final UI.
            yield return(StartCoroutine(m_ReturnFader.InteruptAndFadeIn()));
        }
Example #17
0
    IEnumerator ButtonActive()
    {
        yield return(new WaitForSeconds(timeToButton));

        button.SetActive(true);

        m_Reticle.Show();

        m_Radial.Hide();


        m_HowToUseConfirmSlider.OnBarFilled += LoadMenu;

        yield return(StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeIn()));

        yield return(StartCoroutine(m_HowToUseConfirmSlider.WaitForBarToFill()));

        yield return(StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeOut()));
    }
Example #18
0
    IEnumerator BackToMenu()
    {
        m_Reticle.Show();

        m_Radial.Hide();

        yield return(StartCoroutine(m_Fader.InteruptAndFadeIn()));

        yield return(StartCoroutine(m_Slider.WaitForBarToFill()));

        yield return(StartCoroutine(m_Fader.InteruptAndFadeOut()));

        /*for (int i = 0; i < 10; i++) {
         *
         *      if (tempArray[i] != 0) {
         *
         *              highscoreName += letters[tempArray[i]];
         *      }
         * }
         *
         * highscoreName += chars[charCount].text;*/

        for (int i = 0; i < 10; i++)
        {
            if (chars[i].text != "-")
            {
                highscoreName += chars[i].text;
            }
        }

        if (highscoreName == "Debug")
        {
            clearHighscore();
        }
        else
        {
            PlayerPrefs.SetInt("highscore" + highscorePostion, totalTime);
            PlayerPrefs.SetString("highscoreName" + highscorePostion, highscoreName);
        }

        SceneManager.LoadScene("Start Menu");
    }
Example #19
0
        private void OnTriggerEnter(Collider other)
        {
            // If the triggering transform is not the character or the power is already off, return.
            if (other.transform != m_Character)
            {
                return;
            }

            if (!m_PowerOn)
            {
                return;
            }

            // Play the audio for when the UI gets turned on.
            m_SwitchAudio.clip = m_ActivateGUIClip;
            m_SwitchAudio.Play();

            // Fade in the selection slider.
            StartCoroutine(m_SelectionSliderFader.InteruptAndFadeIn());
        }
Example #20
0
        private IEnumerator StartPhase()
        {
            // Wait for the instructions to fade in.
            yield return(StartCoroutine(m_InstructionsFader.InteruptAndFadeIn()));

            // Turn the reticle on and make it flat to the screen so it can be used with the selection slider.
            m_Reticle.Show();
            m_Reticle.UseNormal = false;

            // The user should hold Fire1 at this point so warn against tapping.
            m_InputWarnings.TurnOnDoubleTapWarnings();

            // Wait for the selection bar to fill indicating the user has read the instructions.
            yield return(StartCoroutine(m_SelectionSlider.WaitForBarToFill()));

            // Turn off the double tap warnings since the user will need to use double tap to move the character.
            m_InputWarnings.TurnOffDoubleTapWarnings();

            // Wait for the instructions to fade out.
            yield return(StartCoroutine(m_InstructionsFader.InteruptAndFadeOut()));
        }
Example #21
0
        [SerializeField] private SelectionSlider m_HowToUseSlider;          // This is the slider that is used to demonstrate how to use them.
        //   [SerializeField] private UIFader m_HowToUseConfirmFader;            // Afterwards users are asked to confirm how to use sliders in this UI.
        // [SerializeField] private SelectionSlider m_HowToUseConfirmSlider;   // They demonstrate this using this slider.
        //   [SerializeField] private UIFader m_ReturnFader;                     // The final instructions are controlled using this fader.


        private IEnumerator Start()
        {
            m_Reticle.Show();

            m_Radial.Hide();

            // In order, fade in the UI on how to use sliders, wait for the slider to be filled then fade out the UI.
            yield return(StartCoroutine(m_HowToUseFader.InteruptAndFadeIn()));

            yield return(StartCoroutine(m_HowToUseSlider.WaitForBarToFill()));

            yield return(StartCoroutine(m_HowToUseFader.InteruptAndFadeOut()));

            SceneManager.LoadScene("GameIntro");

            // In order, fade in the UI on confirming the use of sliders, wait for the slider to be filled, then fade out the UI.
            //     yield return StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeIn());
            //    yield return StartCoroutine(m_HowToUseConfirmSlider.WaitForBarToFill());
            //    yield return StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeOut());

            // Fade in the final UI.
            //    yield return StartCoroutine(m_ReturnFader.InteruptAndFadeIn());
        }
Example #22
0
    [SerializeField] private UIFader m_OutroUI;     // This controls fading the UI shown during the outro.
    //[SerializeField] private UIFader m_PlayerUI;    // This controls fading the UI that shows around the gun that moves with the player.
    //[SerializeField] private Text m_TotalScore;     // Reference to the Text component that displays the player's score at the end.
    //[SerializeField] private Text m_HighScore;      // Reference to the Text component that displays the high score at the end.


    public IEnumerator ShowIntroUI()
    {
        yield return(StartCoroutine(m_IntroUI.InteruptAndFadeIn()));
    }
Example #23
0
    }                                                               // If a UI is currently showing

    public IEnumerator ShowChecklist()
    {
        yield return(StartCoroutine(m_CheckList.InteruptAndFadeIn()));
    }
        private IEnumerator Start()
        {
            m_Reticle.Show();
            //m_Radial.Hide ();

            DontDestroyOnLoad(VRTracker.instance);
            Debug.Log("Instance is spectator :  " + VRTracker.instance.isSpectator);
            bool assignationSuccess = false;

            if (VRTracker.instance.autoAssignation)
            {
                /*
                 * Debug.Log("Loading association");
                 * VRTrackerTagAssociation.instance.LoadAssociation();*/
                Debug.Log("Loading association");
                if (VRTrackerTagAssociation.instance.LoadAssociation())
                {
                    /*for (int i = 0; i < 3 && !VRTracker.instance.assignationComplete; i++)
                     * {
                     *  if (VRTrackerTagAssociation.instance.TryAutoAssignTag())
                     *  {
                     *      assignationSuccess = true;
                     *      break;
                     *  }
                     *
                     *  yield return new WaitForSeconds(1);
                     * }*/
                    assignationSuccess = VRTrackerTagAssociation.instance.TryAutoAssignTag();
                    if (!assignationSuccess)
                    {
                        m_SliderCroup.hideSkipAssignationSlider();
                    }
                    else
                    {
                        //TODO: Load next level directly
                        Debug.Log("Tags where associated from file successfully");
                        //LevelLoader.instance.LoadLevel(1);
                    }
                }
            }

            /*
             * if (!VRTrackerTagAssociation.instance.isAssociationLoaded)
             * {
             *  Debug.LogWarning("hide auto assingation");
             *  m_SliderCroup.hideSkipAssignationSlider();
             * }
             *
             *
             * //Retrieve the player prefab from the network manager
             * GameObject pPrefab = null;
             * if (VRTrackerNetwork.instance.playerPrefab != null)
             * {
             *  pPrefab = VRTrackerNetwork.instance.playerPrefab;
             * }
             * else
             * {
             *  Debug.Log("Player prefab is null");
             * }
             * //Create and prepare the different prefab for assignation in the next scene
             * if (pPrefab != null) {
             *                  VRTrackerTag[] playerObject = pPrefab.GetComponentsInChildren<VRTrackerTag>();
             *                  for (int i = 0; i < playerObject.Length; i++) {
             *                          //Store the different player prefab name for association
             *                          VRTrackerAssociation newAsso = new VRTrackerAssociation();
             *      VRTrackerTagAssociation.instance.AddPrefabAssociation(playerObject[i].gameObject.name, newAsso);
             *                  }
             * }
             * else
             * {
             *  Debug.LogError("No player prefab set !");
             * }
             *
             *          if (VRTracker.instance.autoAssignation)
             *          {
             *  yield return new WaitForSeconds(1);
             *                  VRTracker.instance.AssignDirectlyTags();
             *  if (!VRTracker.instance.assignationComplete)
             *  {
             *      m_SliderCroup.hideSkipAssignationSlider();
             *  }
             * }
             */
                        #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
            VRTracker.instance.isSpectator = false;
            Debug.Log("Setting spectator mode to  :  " + VRTracker.instance.isSpectator);
                        #endif

            if (!VRTracker.instance.isSpectator)
            {
                m_SliderCroup.hideSpectatorMode();
                Debug.Log("Setting spectator mode to  :  " + VRTracker.instance.isSpectator);
            }
            else
            {
                //VRTracker.instance.assignationComplete = true;
            }
            Debug.Log("Instance is spectator :  " + VRTracker.instance.isSpectator);


            // In order, fade in the UI on confirming the use of sliders, wait for the slider to be filled, then fade out the UI.
            if (!assignationSuccess)
            {
                yield return(StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeIn()));

                //yield return StartCoroutine(m_SliderCroup.WaitForBarsToFill());
                yield return(StartCoroutine(m_SliderCroup.WaitForBarsToFill()));

                yield return(StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeOut()));
            }


            // Assign a Tag to each Prefab instance containing a Tag in VR Tracker
            if (!assignationSuccess && !VRTracker.instance.isSpectator)
            {
                Debug.Log("Manual assignement ");
                //Assignement step
                foreach (VRTrackerTag tag in VRTracker.instance.tags)
                //foreach (KeyValuePair<string, VRTrackerAssociation> prefab in VRTrackerTagAssociation.instance.prefabAssociation)
                {
                    Debug.Log("Assigning Tag to " + tag);

                    bool associationFailed = true;
                    while (associationFailed)
                    {
                        // Edit shown title to the Prefab name

                        /*m_AssociationFader.transform.Find("CalibrationInstructions/Title").GetComponentInChildren<Text>().text = "Assign" + prefab.Key;
                         *
                         *
                         * // Start assignation
                         * yield return StartCoroutine(ShowMenu(m_AssociationFader, prefab.Value));
                         *
                         *                      // Check if timed out and throw an error
                         *                      if (!prefab.Value.isIDAssigned)
                         *                      {
                         *                              associationFailed = true;
                         *                              yield return StartCoroutine(ShowMenu(m_FailedCalibrationFader, m_FailedCalibrationSlider));
                         *                      }
                         *                      else
                         *                      {
                         *                              associationFailed = false;
                         *
                         *                      }
                         */

                        // Edit shown title to the Prefab name
                        m_AssociationFader.transform.Find("CalibrationInstructions/Title").GetComponentInChildren <Text>().text = "Assign " + tag.tagType.ToString();

                        // Start assignation
                        yield return(StartCoroutine(ShowMenu(m_AssociationFader, tag)));

                        // Check if timed out and throw an error
                        if (!tag.IDisAssigned)
                        {
                            associationFailed = true;
                            yield return(StartCoroutine(ShowMenu(m_FailedCalibrationFader, m_FailedCalibrationSlider)));
                        }
                        else
                        {
                            associationFailed = false;
                            tag.AssignTag(tag.UID);
                        }
                    }
                }
            }

            if (!VRTracker.instance.isSpectator)
            {
                VRTracker.instance.SaveAssociationTagUser();
                enablePlayerCameraForNextLevel();
            }
            // Load the next Level (the Game !)
            yield return(StartCoroutine(m_LoadingFader.InteruptAndFadeIn()));

            //LevelLoader.instance.LoadLevel(1);
            Debug.Log("Network Address : " + Network.player.ipAddress);
            if (VRTracker.instance.serverIp == "" || VRTracker.instance.serverIp == Network.player.ipAddress)
            {
                VRTracker.instance.serverIp = Network.player.ipAddress;
                VRTracker.instance.sendServerIP(VRTracker.instance.serverIp);
                VRTrackerNetwork.instance.serverBindAddress = VRTracker.instance.serverIp;

                if (VRTracker.instance.isSpectator)
                {
                    Debug.Log("Starting as Server");
                    VRTrackerNetwork.instance.StartServer();
                }
                else
                {
                    Debug.Log("Starting as Host");
                    VRTrackerNetwork.instance.StartHost();
                }
            }
            else
            {
                Debug.Log("Starting client");
                //VRTrackerNetwork.instance.networkAddress = VRTracker.instance.serverIp;
                //VRTrackerNetwork.instance.StartClient ();

                VRTrackerNetwork.instance.serverBindAddress = VRTracker.instance.serverIp;
                VRTrackerNetwork.instance.serverBindToIP    = true;
                VRTrackerNetwork.instance.networkAddress    = VRTracker.instance.serverIp;

                Debug.Log("Server Ip " + VRTrackerNetwork.instance.serverBindAddress);
                Debug.Log("Server Port " + VRTrackerNetwork.instance.networkPort);
                //after binding address, start server
                VRTrackerNetwork.instance.StartClient();
            }
        }
Example #25
0
    private IEnumerator Start()
    {
        m_Reticle.Show();

        DontDestroyOnLoad(VRTracker.instance);
        bool assignationSuccess = false;

        //Disable by default the spectator mode on mobile device
                #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
        VRTracker.instance.isSpectator = false;
                #endif

        //Check if spectator mode is activated
        if (!VRTracker.instance.isSpectator)
        {
            m_SliderCroup.hideSpectatorMode();
            if (VRTracker.instance.autoAssignation)
            {
                VRTrackerTag[] tags = VRTracker.instance.gameObject.GetComponentsInChildren <VRTrackerTag> ();
                while (tags.Length != VRTracker.instance.tags.Count)
                {
                    //Wait for everything to be loaded correctly
                    yield return(new WaitForSeconds(1));
                }
                if (VRTrackerTagAssignment.instance.LoadAssociation())
                {
                    assignationSuccess = VRTrackerTagAssignment.instance.TryAutoAssignTag();
                    if (!assignationSuccess)
                    {
                        m_SliderCroup.hideSkipAssignationSlider();
                    }
                }
            }


            // Assign a Tag to each Prefab instance containing a Tag in VR Tracker
            if (!assignationSuccess)
            {
                // In order, fade in the UI on confirming the use of sliders, wait for the slider to be filled, then fade out the UI.
                yield return(StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeIn()));

                yield return(StartCoroutine(m_SliderCroup.WaitForBarsToFill()));

                yield return(StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeOut()));

                //Assignement step
                foreach (VRTrackerTag tag in VRTracker.instance.tags)
                {
                    bool associationFailed = true;
                    while (associationFailed)
                    {
                        // Edit shown title to the Prefab name
                        m_AssociationFader.transform.Find("CalibrationInstructions/Title").GetComponentInChildren <Text>().text = "Assign " + tag.tagType.ToString();

                        // Start assignation
                        yield return(StartCoroutine(ShowMenu(m_AssociationFader, tag)));

                        // Check if timed out and throw an error
                        if (!tag.IDisAssigned)
                        {
                            associationFailed = true;
                            yield return(StartCoroutine(ShowMenu(m_FailedCalibrationFader, m_FailedCalibrationSlider)));
                        }
                        else
                        {
                            associationFailed = false;
                            tag.AssignTag(tag.UID);
                        }
                    }
                }
            }


            VRTracker.instance.SaveAssociationTagUser();
            enablePlayerCameraForNextLevel();

            // Load the next Level (the Game !)
            yield return(StartCoroutine(m_LoadingFader.InteruptAndFadeIn()));

            if (VRTracker.instance.serverIp == "" || VRTracker.instance.serverIp == Network.player.ipAddress)
            {
                VRTracker.instance.serverIp = Network.player.ipAddress;
                VRTracker.instance.SendServerIP(VRTracker.instance.serverIp);
                VRTrackerNetwork.instance.serverBindAddress = VRTracker.instance.serverIp;
                VRTrackerNetwork.instance.StartHost();
            }
            else
            {
                VRTrackerNetwork.instance.serverBindAddress = VRTracker.instance.serverIp;
                VRTrackerNetwork.instance.serverBindToIP    = true;
                VRTrackerNetwork.instance.networkAddress    = VRTracker.instance.serverIp;
                //after binding address, start server
                VRTrackerNetwork.instance.StartClient();
            }
        }
        else
        {
            VRTracker.instance.serverIp = Network.player.ipAddress;
            VRTracker.instance.SendServerIP(VRTracker.instance.serverIp);
            //Start in spectator mode
            VRTrackerNetwork.instance.StartServer();
        }
    }
Example #26
0
 public IEnumerator ShowPlayerUI()
 {
     yield return(StartCoroutine(playerUI.InteruptAndFadeIn()));
 }
    // Use this for initialization
    private IEnumerator Start()
    {
        playAudioCurrent.Play();
        standBody     = GameObject.Find("Body/StandBody");
        TVscreen      = GameObject.Find("_Level/TVscreen");
        faintBody     = GameObject.Find("Body/FaintBody");
        bareFaintBody = GameObject.Find("Body/BareFaintBody");
        bigPhone      = GameObject.Find("Phone/BigPhone");
        smallPhone    = GameObject.Find("Phone/SmallPhone");
        AED           = GameObject.Find("AED");
        nose          = GameObject.Find("TestText/Nose");
        neck          = GameObject.Find("TestText/Neck");
        shoulder      = GameObject.Find("TestText/Shoulder");
        cpr_Disrobe   = GameObject.Find("Body").transform.Find("FaintBody").gameObject.GetComponent <ClosedToBare>();
        middlePhone   = GameObject.Find("Phone/MiddlePhone");
        //cpr_Start = GameObject.Find("GUI").transform.Find("StartGUI").gameObject.GetComponent<UIFader>();
        //cpr_CheckAED = GameObject.Find("GUI").transform.Find("CheckAEDGUI").gameObject.GetComponent<UIFader>();
        //initialization
        if (standBody == null)
        {
            Debug.Log("MidTermProcManager : Can't find standing body!");
        }
        else
        {
            standBody.SetActive(true);
        }
        if (TVscreen == null)
        {
            Debug.Log("MidTermProcManager : Can't find TV screen!");
        }
        else
        {
            TVscreen.SetActive(false);
        }
        if (AED == null)
        {
            Debug.Log("MidTermProcManager : Can't find AED!");
        }
        else
        {
            AED.SetActive(true);
        }
        if (faintBody == null)
        {
            Debug.Log("MidTermProcManager : Can't find fainted body!");
        }
        else
        {
            faintBody.SetActive(false);
        }
        if (bareFaintBody == null)
        {
            Debug.Log("MidTermProcManager : Can't find bare fainted body!");
        }
        else
        {
            bareFaintBody.SetActive(false);
        }
        if (bigPhone == null)
        {
            Debug.Log("MidTermProcManager : Can't find big phone!");
        }
        else
        {
            bigPhone.SetActive(false);
        }
        if (smallPhone == null)
        {
            Debug.Log("MidTermProcManager : Can't find small phone!");
        }
        else
        {
            smallPhone.SetActive(true);
        }
        if (nose == null)
        {
            Debug.Log("MidTermProcManager : Can't find NoseText!");
        }
        else
        {
            nose.SetActive(false);
        }
        if (neck == null)
        {
            Debug.Log("MidTermProcManager : Can't find NeckText!");
        }
        else
        {
            neck.SetActive(false);
        }
        if (shoulder == null)
        {
            Debug.Log("MidTermProcManager : Can't find ShoulderText!");
        }
        else
        {
            shoulder.SetActive(false);
        }
        if (middlePhone == null)
        {
            Debug.Log("MidTermProcManager : Can't find middlephone!");
        }
        else
        {
            middlePhone.SetActive(false);
        }

        yield return(StartCoroutine(cpr_Start.InteruptAndFadeIn()));

        yield return(StartCoroutine(cpr_StartConfirm.WaitForBarToFill()));

        playAudioCurrent.clip = liuTwo;
        playAudioCurrent.Play();
        yield return(StartCoroutine(cpr_Start.InteruptAndFadeOut()));

        yield return(StartCoroutine(cpr_CheckAED.InteruptAndFadeIn()));

        yield return(StartCoroutine(cpr_AEDController.WaitForCheckingAED()));

        playAudioCurrent.clip = liuThree;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(4));

        yield return(StartCoroutine(cpr_LeftShoulderVisible.Show()));

        yield return(StartCoroutine(cpr_RightShoulderVisible.Show()));

        playAudioCurrent.clip = faintDetect;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(12));

        playAudioCurrent.clip = faintAnnounce;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(6));

        playAudioCurrent.clip = liuFour;
        playAudioCurrent.Play();
        yield return(StartCoroutine(cpr_CheckAED.InteruptAndFadeOut()));

        yield return(StartCoroutine(cpr_Dail.InteruptAndFadeIn()));

        yield return(StartCoroutine(cpr_SetPhone.SetPhone()));

        yield return(StartCoroutine(cpr_DailController.StartDailing()));

        yield return(StartCoroutine(cpr_PutDownPhone.PutItDown()));

        yield return(StartCoroutine(cpr_Dail.InteruptAndFadeOut()));

        playAudioCurrent.clip = liOne;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(2));

        /*playAudioCurrent.clip = liuFive;
         * playAudioCurrent.Play();
         * yield return new WaitForSeconds(13);
         * playAudioCurrent.clip = liTwo;
         * playAudioCurrent.Play();
         * yield return new WaitForSeconds(14);
         * playAudioCurrent.clip = liuSix;
         * playAudioCurrent.Play();
         * yield return new WaitForSeconds(7);
         * playAudioCurrent.clip = liThree;
         * playAudioCurrent.Play();
         * yield return new WaitForSeconds(5);
         * playAudioCurrent.clip = liFour;
         * playAudioCurrent.Play();
         * yield return new WaitForSeconds(7);*/
        yield return(StartCoroutine(cpr_CheckPerson.InteruptAndFadeIn()));

        yield return(StartCoroutine(cpr_NeckVisible.Show()));

        yield return(StartCoroutine(cpr_NoseVisible.Show()));

        playAudioCurrent.clip = liFive;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(16));

        yield return(StartCoroutine(cpr_PersonController.WaitForCheckingPerson()));

        yield return(StartCoroutine(cpr_CheckPerson.InteruptAndFadeOut()));

        yield return(StartCoroutine(cpr_Information.InteruptAndFadeIn()));

        playAudioCurrent.clip = liSix;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(9));

        playAudioCurrent.clip = liSeven;
        yield return(new WaitForSeconds(20));

        playAudioCurrent.Play();
        yield return(StartCoroutine(cpr_Disrobe.CheckBare()));

        noise.Stop();


        /*playAudioCurrent.clip = liEight;
         * playAudioCurrent.Play();
         * yield return new WaitForSeconds(10);*/
        playAudioCurrent.clip = liNine;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(10));

        playAudioCurrent.clip = liTen;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(4));

        playAudioCurrent.clip = liEleven;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(4));

        playAudioCurrent.clip = liTwelve;
        playAudioCurrent.Play();
        yield return(StartCoroutine(cpr_TrainController.LocomotionTracker()));

        playAudioCurrent.clip = count;
        playAudioCurrent.loop = true;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(30));

        playAudioCurrent.clip   = ambulance;
        playAudioCurrent.volume = 0;
        playAudioCurrent.Play();
        while (n < 1000)
        {
            playAudioCurrent.volume += 0.001f; ++n;
        }
        yield return(new WaitForSeconds(5));

        playAudioCurrent.loop = false;
        playAudioCurrent.clip = liuSeven;
        playAudioCurrent.Play();
        yield return(new WaitForSeconds(3));

        playAudioCurrent.clip = liFifteen;
        playAudioCurrent.Play();
        yield return(StartCoroutine(cpr_Information.InteruptAndFadeOut()));
        //Debug.Log ("111");
    }
        private IEnumerator Start()
        {
            m_Reticle.Show();
            //m_Radial.Hide ();

            DontDestroyOnLoad(VRTracker.instance);
            if (VRTracker.instance.autoAssignation)
            {
                Debug.Log("Loading association");
                VRTrackerTagAssociation.instance.LoadAssociation();
            }
            if (!VRTrackerTagAssociation.instance.isAssociationLoaded)
            {
                Debug.LogWarning("hide auto assingation");
                m_SliderCroup.hideSkipAssignationSlider();
            }

            GameObject pPrefab = NetworkManager.singleton.playerPrefab;

            //Create and prepare the different prefab for assignation in the next scene
            if (pPrefab != null)
            {
                VRTrackerTag[] playerObject = pPrefab.GetComponentsInChildren <VRTrackerTag>();
                for (int i = 0; i < playerObject.Length; i++)
                {
                    //Store the different player prefab name for association
                    VRTrackerAssociation newAsso = new VRTrackerAssociation();
                    VRTrackerTagAssociation.instance.addPrefabAssociation(playerObject[i].gameObject.name, newAsso);
                }
            }

            if (VRTracker.instance.autoAssignation)
            {
                yield return(new WaitForSeconds(1));

                VRTracker.instance.assignDirectlyTags();
                if (!VRTracker.instance.assignationComplete)
                {
                    m_SliderCroup.hideSkipAssignationSlider();
                }
            }

            // In order, fade in the UI on confirming the use of sliders, wait for the slider to be filled, then fade out the UI.
            yield return(StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeIn()));

            yield return(StartCoroutine(m_SliderCroup.WaitForBarsToFill()));

            //yield return StartCoroutine(m_SliderCroup.WaitForBarsToFill());
            yield return(StartCoroutine(m_HowToUseConfirmFader.InteruptAndFadeOut()));


            // Assign a Tag to each Prefab instance containing a Tag in VR Tracker
            if (!VRTracker.instance.isAssigned())
            {
                Debug.Log("Manual assignement ");

                //Assignement step
                //foreach (VRTrackerTag tagObject in VRTracker.instance.tags)
                foreach (KeyValuePair <string, VRTrackerAssociation> prefab in VRTrackerTagAssociation.instance.prefabAssociation)
                {
                    Debug.Log("Assigning Tag to " + prefab.Key);

                    bool associationFailed = true;
                    while (associationFailed)
                    {
                        // Edit shown title to the Prefab name
                        m_AssociationFader.transform.Find("CalibrationInstructions/Title").GetComponentInChildren <Text>().text = "Assign" + prefab.Key;

                        // Start assignation
                        yield return(StartCoroutine(ShowMenu(m_AssociationFader, prefab.Value)));

                        // Check if timed out and throw an error
                        if (!prefab.Value.isIDAssigned)
                        {
                            associationFailed = true;
                            yield return(StartCoroutine(ShowMenu(m_FailedCalibrationFader, m_FailedCalibrationSlider)));
                        }
                        else
                        {
                            associationFailed = false;
                        }
                    }
                }
            }

            VRTracker.instance.saveAssociationTagUser();
            // Load the next Level (the Game !)
            enablePlayerCameraForNextLevel();
            Debug.Log("Loading next level");
            yield return(StartCoroutine(m_LoadingFader.InteruptAndFadeIn()));

            //LevelLoader.instance.LoadLevel(1);
            if (VRTracker.instance.serverIp == "")
            {
                VRTracker.instance.serverIp = Network.player.ipAddress;
                VRTracker.instance.sendServerIP(VRTracker.instance.serverIp);
                NetworkManager.singleton.serverBindAddress = VRTracker.instance.serverIp;
                #if UNITY_EDITOR || UNITY_STANDALONE
                Debug.LogWarning("Unity Editor");
                #endif

                if (VRTracker.instance.isSpectator)
                {
                    Debug.Log("Starting as Server");
                    NetworkManager.singleton.StartServer();
                }
                else
                {
                    Debug.Log("Starting as Host");
                    NetworkManager.singleton.StartHost();
                }
            }
            else
            {
                Debug.Log("Starting client");
                NetworkManager.singleton.networkAddress = VRTracker.instance.serverIp;
                NetworkManager.singleton.StartClient();

                NetworkManager.singleton.serverBindAddress = VRTracker.instance.serverIp;
                NetworkManager.singleton.serverBindToIP    = true;
                NetworkManager.singleton.networkAddress    = VRTracker.instance.serverIp;

                Debug.Log("Server Ip " + NetworkManager.singleton.serverBindAddress);
                Debug.Log("Server Port " + NetworkManager.singleton.networkPort);
                //after binding address, start server
                NetworkManager.singleton.StartClient();
            }
        }
 /// <summary>
 /// Shows the user we are loading the next scene.
 /// </summary>
 /// <returns>The loading next scene.</returns>
 public override IEnumerator ShowLoadingNextScene()
 {
     yield return(StartCoroutine(m_LoadingFader.InteruptAndFadeIn()));
 }
Example #30
0
        public Text m_HighScore;      // The text component used to display the high score.


        public IEnumerator ShowIntroUI()
        {
            // Interupt any fading the intro UI is already doing and fade in, return when finished.
            yield return(StartCoroutine(m_IntroUI.InteruptAndFadeIn()));
        }