Stop Dialogue#
Game Creator / Dialogue / Stop Dialogue
Description#
Stops playing a Dialogue component
Note
Signals the Dialogue component to stop playing. The effect might be delayed by 1 frame
Parameters#
| Name | Description |
|---|---|
| Dialogue | The Dialogue to stop |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
using VisualScript.Runtime;
namespace GameCreator.Runtime.Dialogue
{
[Title("Stop Dialogue")]
[Image(typeof(IconDialogue), ColorTheme.Type.Blue, typeof(BadgeCross))]
[Description("Stops playing a Dialogue component")]
[Category("Game Creator/Dialogue/Stop Dialogue")]
[Parameter("Dialogue", "The Dialogue to stop")]
[Keywords("Dialogue", "Script", "Cancel", "End", "Finish")]
[Note("Signals the Dialogue component to stop playing. The effect might be delayed by 1 frame")]
[Serializable]
public class InstructionDialogueStop : Instruction
{
[SerializeField] private GetGameObject m_Dialogue = new GetGameObject(
new TypeGameObjectDialogue()
);
protected override string GetTitle(GameObject source) => $"Stop {this.m_Dialogue}";
protected override Awaitable Run(Args args)
{
Dialogue dialogue = this.m_Dialogue.Get<Dialogue>(args);
if (dialogue != null) dialogue.Cancel();
return Done;
}
}
}