Ejemplo n.º 1
0
    protected override IEnumerator ActionRoutine()
    {
        nextButtonVisible = false;
        _nextPressed      = false;
        string finalText = _text;


        if (_texto != null)
        {
            finalText = _texto;
        }

        speakStartEvent.Invoke(_characterData, finalText, parentConversation.conversationType);

        yield return(0f);

        yield return(new WaitForSeconds(0.25f));

        nextButtonVisible = true;

        float speakingDuration = 1f;


        speakingDuration = ExtraMath.Map(finalText.Length, 0, 100, 0, 5f);
        //Debug.Log("chillin "+ _input.inputSystem_Menu.confirm.onDown);


        if (parentConversation.conversationType == Conversation.ConversationType.MissionDialogue)
        {
            currentVisibleCharactersRatio = 0;

            while (currentVisibleCharactersRatio < 1)
            {
                currentVisibleCharactersRatio += (Time.deltaTime / ((float)finalText.Length)) * _charactersPerSecond;

                if (_input.menuSubmit.triggered)//_input.inputSystem_Menu.confirm.onDown)
                {
                    currentVisibleCharactersRatio = 1;
                }

                speakingDuration -= Time.deltaTime;
                yield return(0f);
            }

            currentVisibleCharactersRatio = 1;

            while (true)
            {
                speakingDuration -= Time.deltaTime;

                if (_input.menuSubmit.triggered)//_input.inputSystem_Menu.confirm.onDown)
                {
                    break;
                }

                yield return(0f);
            }
        }
        else
        {
            yield return(new WaitForSeconds(speakingDuration));
        }

        yield return(0f);



        yield return(StartCoroutine(base.ActionRoutine()));
    }