Has Visited Script Line#
Game Creator / Dialogue / Has Visited Script Line
Description#
Returns success if the Dialogue component has seen the given Script line
Parameters#
| Name | Description |
|---|---|
| Dialogue | The targeted Dialogue component |
| Line ID | The Script line ID to check |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
using VisualScript.Runtime;
namespace GameCreator.Runtime.Dialogue
{
[Title("Has Visited Script Line")]
[Image(typeof(IconBubbleOutline), ColorTheme.Type.TextLight)]
[Description("Returns success if the Dialogue component has seen the given Script line")]
[Category("Game Creator/Dialogue/Has Visited Script Line")]
[Parameter("Dialogue", "The targeted Dialogue component")]
[Parameter("Line ID", "The Script line ID to check")]
[Keywords("Dialogue", "Line", "Text", "Script", "Narration", "Seen")]
[Serializable]
public class ConditionDialogueHasVisitedLine : Condition
{
[SerializeField] private GetGameObject m_Dialogue = new GetGameObject(
new TypeGameObjectDialogue()
);
[SerializeField] private GetString m_LineID = new GetString("my-line-id");
protected override string GetTitle(GameObject source) => $"{this.m_Dialogue} has visited {this.m_LineID}";
protected override bool Run(Args args)
{
Dialogue dialogue = this.m_Dialogue.Get<Dialogue>(args);
return dialogue != null && dialogue.HasVisitedLineId(this.m_LineID.Get(args));
}
}
}