Files
AppleHillsProduction/Assets/Scripts/Dialogue/RuntimeDialogueGraph.cs
tschesky f686f28cb8 Create a simple dialogue authoring system, tied into our items (#10)
- Editor dialogue graph
- Asset importer for processing the graph into runtime data
- DialogueComponent that steers the dialogue interactions
- DialogueCanbas with a scalable speech bubble to display everything
- Brief README overview of the system

Co-authored-by: AlexanderT <alexander@foolhardyhorizons.com>
Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Reviewed-on: #10
2025-09-29 09:34:15 +00:00

55 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
namespace Dialogue
{
[Serializable]
public enum RuntimeDialogueNodeType
{
Dialogue,
WaitOnPuzzleStep,
WaitOnPickup,
WaitOnSlot,
WaitOnCombination,
End
}
[Serializable]
public class RuntimeDialogueGraph : ScriptableObject
{
public string entryNodeID;
public string speakerName;
public List<RuntimeDialogueNode> allNodes = new List<RuntimeDialogueNode>();
// Helper method to find a node by ID
public RuntimeDialogueNode GetNodeByID(string id)
{
return allNodes.Find(n => n.nodeID == id);
}
}
[Serializable]
public class RuntimeDialogueNode
{
public string nodeID;
public RuntimeDialogueNodeType nodeType;
public string nextNodeID;
// Basic dialogue
public List<string> dialogueLines = new List<string>();
public bool loopThroughLines;
// Conditional nodes
public string puzzleStepID; // For WaitOnPuzzleStep
public string pickupItemID; // For WaitOnPickup
public string slotItemID; // For WaitOnSlot
public string combinationResultItemID; // For WaitOnCombination
// For WaitOnSlot - different responses
public List<string> incorrectItemLines = new List<string>();
public bool loopThroughIncorrectLines;
public List<string> forbiddenItemLines = new List<string>();
public bool loopThroughForbiddenLines;
}
}