46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Unheimlich.Data.Dialogues
|
|
{
|
|
[CreateAssetMenu(fileName = "NewDialogueNode", menuName = "Unheimlich/Dialogue/Dialogue Node")]
|
|
public class DialogueNode : ScriptableObject
|
|
{
|
|
[Header("Content")]
|
|
[TextArea(3, 10)]
|
|
[Tooltip("Text displayed for this dialogue node")]
|
|
public string DialogueText;
|
|
|
|
[Header("Localization")]
|
|
[Tooltip("Localization key for the dialogue text")]
|
|
public string DialogueTextLocalizationKey;
|
|
|
|
[Header("Choices")]
|
|
[Tooltip("List of available choices for this dialogue. If empty, this is an end node")]
|
|
public List<DialogueChoiceData> Choices = new List<DialogueChoiceData>();
|
|
|
|
[Header("End Node Settings")]
|
|
[Tooltip("For end nodes (no choices), delay in seconds before automatic close. 0 = requires player interaction to close")]
|
|
public float AutoCloseDelay = 3f;
|
|
|
|
public bool IsEndNode()
|
|
{
|
|
return Choices == null || Choices.Count == 0;
|
|
}
|
|
|
|
public bool HasValidChoices()
|
|
{
|
|
if (Choices == null || Choices.Count == 0)
|
|
return false;
|
|
|
|
foreach (var choice in Choices)
|
|
{
|
|
if (choice != null && choice.NextNode != null)
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|