Example #1
0
 /// <summary>automatically called by YarnCharacter.Start() so that YarnCharacterView knows they exist</summary>
 public void RegisterYarnCharacter(YarnCharacter newCharacter)
 {
     if (!YarnCharacterView.instance.allCharacters.Contains(newCharacter))
     {
         allCharacters.Add(newCharacter);
     }
 }
Example #2
0
 /// <summary>automatically called by YarnCharacter.OnDestroy() to clean-up</summary>
 public void ForgetYarnCharacter(YarnCharacter deletedCharacter)
 {
     if (YarnCharacterView.instance.allCharacters.Contains(deletedCharacter))
     {
         allCharacters.Remove(deletedCharacter);
     }
 }
Example #3
0
        public override void RunLine(LocalizedLine dialogueLine, Action onDialogueLineFinished)
        {
            // Try and get the character name from the line
            string characterName = dialogueLine.CharacterName;

            // if null, Update() will use the playerCharacter instead
            speakerCharacter = !string.IsNullOrEmpty(characterName) ? FindCharacter(characterName) : null;

            // IMPORTANT: we must mark this view as having finished its work, or else the DialogueRunner gets stuck forever
            onDialogueLineFinished();
        }
Example #4
0
        public override void RunLine(LocalizedLine dialogueLine, Action onDialogueLineFinished)
        {
            // Try and get the character name from the line
            var hasCharacterName = dialogueLine.Text.TryGetAttributeWithName("character", out var characterAttribute);

            if (hasCharacterName)
            {
                speakerCharacter = FindCharacter(characterAttribute.Properties["name"].StringValue);
            }
            else
            {
                speakerCharacter = null; // if null, Update() will use the playerCharacter instead
            }

            // IMPORTANT: we must mark this view as having finished its work, or else the DialogueRunner gets stuck forever
            onDialogueLineFinished();
        }