ConversationEndQuestCondition.cs
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
namespace PixelCrushers.QuestMachine
{
/// <summary>
/// Condition that becomes true when the active conversation ends.
/// </summary>
public class ConversationEndQuestCondition : QuestCondition
{
public override string GetEditorName()
{
return "Dialogue System Conversation Has Ended";
}
public override void StartChecking(System.Action trueAction)
{
base.StartChecking(trueAction);
DialogueManager.instance.conversationEnded += OnConversationEnded;
}
public override void StopChecking()
{
base.StopChecking();
DialogueManager.instance.conversationEnded -= OnConversationEnded;
}
private void OnConversationEnded(Transform actor)
{
SetTrue();
}
}
}