Active Line Actor Description#
Game Creator / Dialogue / Active Line Actor Description
Can Read
Cannot Write
Description#
Returns the Actor Description value of the current active line of the Dialogue component
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
using VisualScript.Runtime;
namespace GameCreator.Runtime.Dialogue
{
[Get]
[Title("Active Line Actor Description")]
[Category("Game Creator/Dialogue/Active Line Actor Description")]
[Description("Returns the Actor Description value of the current active line of the Dialogue component")]
[Image(typeof(IconScriptActor), ColorTheme.Type.TextLight, typeof(BadgeHash))]
[Serializable]
public class TypeStringDialogueActiveLineActorDescription : TypeString
{
[SerializeField] private GetGameObject m_Dialogue = new GetGameObject(
new TypeGameObjectDialogue()
);
public override string Get(Args args)
{
Dialogue dialogue = this.m_Dialogue.Get<Dialogue>(args);
if (dialogue == null || dialogue.CurrentNode is not NodeText nodeText) return string.Empty;
ScriptActor actor = RuntimeScript.GetActor(dialogue.CurrentRuntimeScript, nodeText.Actor);
return actor?.GetDescription(dialogue.CurrentRuntimeScript.Args);
}
public override string ToString()
{
return $"Active {this.m_Dialogue} Actor Description";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}