예제 #1
0
    private void StartTurtorial(bool foreceEnable)
    {
        if (foreceEnable || firstTurtorial)
        {
            if (firstTurtorial)
            {
                firstTurtorial = false;
                StoreSettings();
            }

            flowController.EnableTurtorialMode();
            turtorialController.PrepareFirstTurtorial();
            // Enable manipulation with hands
            handsTrackingController.EnableHandManipulation();
            handsTrackingController.DisableDataCollection();
            handsTrackingController.SetTurtorialMode(true);
            // Appear Menu
            if (turtorialScreen != null) //Create Play menu
            {
                UtilitiesScript.Instance.EnableObject(turtorialScreen);
            }
            else
            {
                turtorialScreen = Instantiate(TurtorialPrefab);
                turtorialScreen.transform.position = currentMenu.transform.position;
                turtorialScreen.transform.rotation = currentMenu.transform.rotation;
            }

            for (int i = 0; i < turtorialScreen.transform.childCount; i++)
            {
                child = turtorialScreen.transform.GetChild(i).gameObject;
                if (child.name == "SkipButton")
                {
                    child.GetComponentInChildren <TextMesh>().text = greekEnabled ? el_TurtorialSkipButton : en_TurtorialSkipButton;
                }
                else if (child.name == "GateButton")
                {
                    child.GetComponentInChildren <TextMesh>().text = greekEnabled ? el_TurtorialEnableGateButton : en_TurtorialEnableGateButton;
                }
                else if (child.name == "ExitButton")
                {
                    child.GetComponentInChildren <TextMesh>().text = greekEnabled ? el_TurtorialExitButton : en_TurtorialExitButton;
                }
            }

            UtilitiesScript.Instance.DisableObject(currentMenu);
            currentMenu = turtorialScreen;
            inMenu      = 6;

            if (greekEnabled)
            {
                audioSource.Stop();
                audioSource.clip = TutorialBeginClip;
                audioSource.Play();
            }
            else
            {
                TextToSpeech.Instance.StopSpeaking();
                TextToSpeech.Instance.StartSpeaking("Turtorial Mode has been loaded. In the wall there is a menu" +
                                                    "where you can see three buttons. One for skippping for the turtorial, another one for enabling or disabling gate turtorial" +
                                                    "and the last one to return to start menu. Above buttons there is a video turtorial so you can see how hand recognision" +
                                                    "and object manipulation works. Click on it to play or stop this video.");
            }
        }
        else
        {
            //Ask user for turtorial -- Create this menu
            if (askTurtorialScreen == null)
            {
                askTurtorialScreen = Instantiate(askForTurtorialPrefab, currentMenu.transform.position, currentMenu.transform.rotation);
            }
            else
            {
                UtilitiesScript.Instance.EnableObject(askTurtorialScreen);
                askTurtorialScreen.transform.position = currentMenu.transform.position;
            }

            for (int i = 0; i < askTurtorialScreen.transform.childCount; i++)
            {
                child = askTurtorialScreen.transform.GetChild(i).gameObject;
                if (child.name == "AskText")
                {
                    child.GetComponentInChildren <TextMesh>().text = greekEnabled ? el_AskText : en_AskText;
                }
                else if (child.name == "SkipButton")
                {
                    child.GetComponentInChildren <TextMesh>().text = greekEnabled ? el_AskSkipButton : en_AskSkipButton;
                }
                else if (child.name == "EnableButton")
                {
                    child.GetComponentInChildren <TextMesh>().text = greekEnabled ? el_AskEnableButton : en_AskEnableButton;
                }
                else if (child.name == "ExitButton")
                {
                    child.GetComponentInChildren <TextMesh>().text = greekEnabled ? el_AskExitButton : en_AskExitButton;
                }
            }
            if (greekEnabled)
            {
                audioSource.Stop();
                audioSource.clip = askTutorialClip;
                audioSource.Play();
            }
            else
            {
                TextToSpeech.Instance.StopSpeaking();
                TextToSpeech.Instance.StartSpeaking("Do you want to enter to the hand recognition tutorial ?");
            }

            UtilitiesScript.Instance.DisableObject(currentMenu);
            currentMenu = askTurtorialScreen;
            inMenu      = 5;
            if (menuPosition != Vector3.zero && menuRotation != new Quaternion())
            {
                currentMenu.transform.position = menuPosition;
                currentMenu.transform.rotation = menuRotation;
            }
        }
    }