コード例 #1
0
    public CutsceneSpeakingLine(string speaker, string lineText, int lineNumber, string label = "") : base(speaker, lineText, lineNumber, label)
    {
        if (lineText.StartsWith("**"))
        {
            type = DialogueBubbleType.Thought;
        }
        if (lineText.StartsWith("^^"))
        {
            type = DialogueBubbleType.Exclamation;
        }
        if (lineText.StartsWith("~~"))
        {
            type = DialogueBubbleType.Whisper;
        }
        if (lineText.StartsWith("``"))
        {
            type = DialogueBubbleType.Weak;
        }

        if (lineText.StartsWith("**") || lineText.StartsWith("^^") || lineText.StartsWith("~~"))
        {
            lineText = lineText.Substring(2);
        }

        if (speaker != "" && !lineText.Contains("<i>"))
        {
            lineText = speaker + ": " + lineText;
        }

        content = new SpeakingLineContent(speaker, lineText, lineNumber);
    }
コード例 #2
0
    private IEnumerator animateText(SpeakingLineContent content)
    {
        dialogueLineFinished = false;
        float FADE_TIME = 0.2f;
        float fadeTimer = 0.0f;

        // fading out;
        while (fadeTimer < FADE_TIME)
        {
            fadeTimer += Time.deltaTime;
            text.color = Color.Lerp(textColor, Color.clear, fadeTimer / FADE_TIME);
            yield return(new WaitForEndOfFrame());
        }

        text.text = content.lineText;

        // fading in;
        fadeTimer = 0.0f;
        while (fadeTimer < FADE_TIME)
        {
            fadeTimer += Time.deltaTime;
            text.color = Color.Lerp(Color.clear, textColor, fadeTimer / FADE_TIME);
            yield return(new WaitForEndOfFrame());
        }

        yield return(new WaitForSeconds(0.2f));

        while (!Controls.confirmInputDown())
        {
            yield return(null);
        }

        dialogueLineFinished = true;
    }
コード例 #3
0
    //Displays the a speech bubble according to its text and position in the overall dialogue
    public void DisplaySpeechBubble(SpeakingLineContent speakingLineContent, Vector3 speakerPosition, DialogueBubbleType type = DialogueBubbleType.Speech)
    {
        ready = false;

        int lineNumber = speakingLineContent.lineNumber;

        // *(offscreen dialogue we will need to handle seperately)
        SpeechBubble speechBubble = DialogueUIController.GenerateSpeechBubblePrefab(type);

        speechBubble.SetDialogueBubbleContent(speakingLineContent);
        dialogueBubbles.Add(speechBubble);

        DeployBubble(speechBubble, speakerPosition);

        StartCoroutine(animateLogs(lineNumber));
    }
コード例 #4
0
    //Displays the a speech bubble according to its text and position in the overall dialogue
    public void DisplaySpeechBubble(SpeakingLineContent speakingLineContent, Vector3 speakerPosition)
    {
        int lineNumber = speakingLineContent.lineNumber;

        ready = false;
        Vector2 speakerScreenPosition = dialogueCamera.WorldToScreenPoint(speakerPosition);

        float relativeXdisplacment = (Camera.main.pixelWidth / 2.0f - speakerScreenPosition.x) / Camera.main.pixelWidth;
        float relativeYdisplacment = (Camera.main.pixelHeight / 2.0f - speakerScreenPosition.y) / Camera.main.pixelHeight + 0.1f; // The dialogue should always be in the upper portion of the screen

        Vector2 displacementVector = new Vector2(relativeXdisplacment, relativeYdisplacment);

        // *(offscreen dialogue we will need to handle seperately)
        DialogueBubble speechBubble = speechBubbles[lineNumber];

        speechBubble.SetDialogueBubbleContent(speakingLineContent);
        DialogueUIController.DeploySpeechBubbleAt(speechBubble, speakerPosition, displacementVector);

        StartCoroutine(animateLogs(lineNumber));
    }
コード例 #5
0
    public SpeakingLine(string speaker, string lineText, int lineNumber)
    {
        content = new SpeakingLineContent(speaker, lineText, lineNumber);

        speakerAnimator = GameObject.Find(speaker).GetComponent <DialogueAnimator>();
    }
コード例 #6
0
 public void SetDialogueBubbleContent(SpeakingLineContent content)
 {
     textMesh.text = content.lineText;
 }
コード例 #7
0
 internal void DisplayText(SpeakingLineContent content)
 {
     StartCoroutine(animateText(content));
 }