Esempio n. 1
0
    public void Next()
    {
        nextButton.SetActive(false);

        if (GameManager.Instance.isIntro)
        {
            introTextIndex++;
            if (introTextIndex >= introText.Length)
            {
                answerCharacterIndex         = 0;
                partialAnswer.text           = "";
                fullAnswer                   = "";
                GameManager.Instance.isIntro = false;
                GameManager.Instance.ReturnToMap();
            }
            else
            {
                answerCharacterIndex = 0;
                partialAnswer.text   = "";
                fullAnswer           = introText[introTextIndex];
            }
        }
        else
        {
            partialAnswer.text = "";
            currentState       = GameScene_SM.INITIALIZING;
        }
    }
Esempio n. 2
0
    void OnEnable()
    {
        GameManager.Instance.SceneChanged(sceneName);
        ResetButtons();
        questionAsked        = -1;
        answerCharacterIndex = 0;
        partialAnswer.text   = "";
        fullAnswer           = "";



        if (GameManager.Instance.isIntro && introText.Length > 0)
        {
            fullAnswer = introText[0];
            dialogBox.SetActive(true);
            currentState = GameScene_SM.ON_INTRO;
        }
        else
        {
            currentState = GameScene_SM.INITIALIZING;
        }
    }
Esempio n. 3
0
    // Use this for initialization
    void Update()
    {
        switch (currentState)
        {
        case GameScene_SM.INITIALIZING:

            LoadButtons();

            if (partialAnswer.text == "")
            {
                dialogBox.SetActive(false);
            }

            if (!unableToGoBack && !GameManager.Instance.isIntro)
            {
                EnableGoToMapButton(true);
            }
            else
            {
                GameManager.Instance.isIntro = false;
                unableToGoBack = false;
            }

            currentState = GameScene_SM.WAITING_FOR_QUESTION;
            break;

        case GameScene_SM.WAITING_FOR_QUESTION:
            if (questionAsked != -1)
            {
                EnableGoToMapButton(false);

                ResetButtons();

                dialogBox.SetActive(true);

                currentState = GameScene_SM.WRITING_ANSWER;
            }
            break;

        case GameScene_SM.WRITING_ANSWER:
            if (partialAnswer.text.Length == fullAnswer.Length)
            {
                currentState = GameScene_SM.ON_ANSWER_FINISH;
            }
            else
            {
                t += Time.deltaTime * writeSpeed;

                if (t >= 1)
                {
                    //ACA

                    partialAnswer.text += fullAnswer[answerCharacterIndex];
                    answerCharacterIndex++;
                    t -= 1;
                }
            }
            break;

        case GameScene_SM.ON_ANSWER_FINISH:
            questionAsked = -1;
            fullAnswer    = "";
            nextButton.SetActive(true);
            //currentState = GameScene_SM.INITIALIZING;
            break;

        case GameScene_SM.ON_INTRO:
            if (partialAnswer.text.Length == fullAnswer.Length)
            {
                nextButton.SetActive(true);
            }
            else
            {
                t += Time.deltaTime * writeSpeed;

                if (t >= 1)
                {
                    //ACA

                    partialAnswer.text += fullAnswer[answerCharacterIndex];
                    answerCharacterIndex++;
                    t -= 1;
                }
            }
            break;
        }
    }