Esempio n. 1
0
    private IEnumerator StartDialog()
    {
        while (_sceneId != "end")
        {
            yield return(new WaitUntil(() => _tw.canWrite));

            currentScene = FindSceneById(_sceneId);
            if (_sceneId[0] == 'm')
            {
                _minigamesManager.SetupMinigame(currentScene);

                yield return(new WaitUntil(() => _minigamesManager.minigameFinished));

                Debug.Log("Minigame Finished");
                currentScene = FindSceneById(currentScene.nextSceneId);
            }



            if (currentScene.textAuthor != "" && currentScene.text != "")
            {
                _tw.TypewriteSentence(currentScene, currentScene.textAuthor);
            }
            else if (currentScene.textAuthor == "" && currentScene.text != "")
            {
                currentScene.currentTextField.color = new Color(currentScene.currentTextField.color.r, currentScene.currentTextField.color.g, currentScene.currentTextField.color.b, 1);
                _tw.TypewriteSentence(currentScene);
            }
            if (_sceneId[0] == 'x')
            {
                dialogChoices.SetupChoices(_sceneId);

                yield return(new WaitUntil(() => dialogChoices.currentChoice.choiceMade));

                currentScene.nextSceneId = dialogChoices.currentChoice.wybor.destinationId;
            }

            _sceneId = currentScene.nextSceneId;
            PlayerPrefs.SetString("Saved", _sceneId);
        }
    }
Esempio n. 2
0
    private IEnumerator Sequence()                                     // Coroutine that shows every text line with delay from inspector
    {
        for (int i = 0; i < introDialogue.Count; i++)
        {
            if (_isSkipped)
            {
                break;
            }

            yield return(new WaitUntil(() => _typeWriter.canWrite || _isSkipped));

            _typeWriter.TypewriteSentence(new DialogScene(introDialogue[i].text, welcomeText, introDialogue[i].delay), writeSpeed);
        }
        yield return(new WaitForSeconds(3));                            // Wait 3 seconds after last text to fade out

        StartCoroutine(FadeOutText());
    }