55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using OctoCore.Localization;
|
|
using Unheimlich.Features.DetectiveBoard.Data;
|
|
|
|
namespace Unheimlich.Features.Dialogue.Data
|
|
{
|
|
[CreateAssetMenu(fileName = "NewDialogueNode", menuName = "Unheimlich/Dialogue/Dialogue Node")]
|
|
public class DialogueNode : ScriptableObject
|
|
{
|
|
[Header("Content")]
|
|
[Tooltip("Localized text displayed for this dialogue node")]
|
|
public OctoLocalizedTextData DialogueText;
|
|
|
|
[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;
|
|
|
|
[Header("Detective Board Integration")]
|
|
[Tooltip("Clue to unlock when this node is reached. Useful for end nodes to unlock evidence after a conversation")]
|
|
public ClueData ClueToUnlock;
|
|
|
|
public string GetLocalizedDialogueText()
|
|
{
|
|
if (DialogueText != null)
|
|
return OctoLocalization.GetLocalizedText(DialogueText);
|
|
|
|
return string.Empty;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|