Exemple #1
0
    /// <summary>
    /// Does a delayed text write effect
    /// </summary>
    private IEnumerator <WaitForSeconds> PlayDialogue(AudioDialogue dialogue)
    {
        audioManager.PlayDialogSound(dialogue.audioEvent, gameObject);

        var text = dialogue.line;

        int totalToShow     = text.Length;
        int shownSoFarCount = 0;

        while (totalToShow > shownSoFarCount)
        {
            shownSoFarCount++;
            promptText.text = text.Substring(0, shownSoFarCount);

            // If the text is done rendering, wait for our prompt delay, then hide the prompt
            if (totalToShow == shownSoFarCount)
            {
                yield return(new WaitForSeconds(closePromptDelay * Time.fixedDeltaTime));

                HidePrompt();
            }
            else
            {
                // Wait until we should show the next text character
                yield return(new WaitForSeconds(showLetterDelay * Time.fixedDeltaTime));
            }
        }
    }
Exemple #2
0
    public AudioDialogue GetNextStoryPrompt()
    {
        AudioDialogue prompt = storyPrompts[currentStoryPromptIndex];

        if (currentStoryPromptIndex + 1 < storyPrompts.Count)
        {
            currentStoryPromptIndex++;
        }

        return(prompt);
    }
Exemple #3
0
    public AudioDialogue GetNextRespawnPrompt()
    {
        AudioDialogue prompt = respawnPrompts[currentRespawnPromptIndex];

        if (currentRespawnPromptIndex + 1 < respawnPrompts.Count)
        {
            currentRespawnPromptIndex++;
        }
        else
        {
            currentRespawnPromptIndex = 0;
        }

        return(prompt);
    }