Example #1
0
    /// <summary>
    /// Change the portrait of the person talking
    /// </summary>
    /// <param name="portrait">Portrait struct that contains name and sprite name</param>
    private void ChangeSprite(Portrait portrait)
    {
        if (portrait.spriteName.Length == 0)
        {
            // if the sprite name is an empty string
            return;
        }
        talkingSprite.enabled = true; // want to show sprite
        Sprite personSprite = spriteHolder.GetSprite(portrait.spriteName);

        talkingSprite.sprite = personSprite;
    }
Example #2
0
    /// <summary>
    /// Update the dialogue text and protrait
    /// </summary>
    private void updateDialogue()
    {
        string text = currDialogue[currDialogueIndx];

        string[] stepString = Parser.SplitLogicDialogue(text);

        Portrait portrait = Parser.ParsePortrait(stepString[0]);         // get the name and sprite name
        string   dialogue = stepString[1];                               // get dialogue
        Sprite   sprite   = spriteHolder.GetSprite(portrait.spriteName); // get the sprite

        Name.text       = portrait.name;
        Portrait.sprite = sprite;
        if (portrait.animationTime > 0f)
        {
            StartCoroutine(playAnimationCo(portrait.animationName, portrait.animationTime));
        }
        Dialogue.text = dialogue;
    }