DialogueNode

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; namespace NomnomPlugins.DialogueSystem { [System.Serializable] public class DialogueNode { public enum NodeType { START, END, TEXT, CHOICE } const string START_NODE_ON = "flow node hex 0 on"; const string START_NODE_OFF = "flow node hex 0"; const string END_NODE_ON = "flow node hex 1 on"; const string END_NODE_OFF = "flow node hex 1"; const string TEXT_NODE_ON = "flow node 0 on"; const string TEXT_NODE_OFF = "flow node 0"; const string CHOICE_NODE_ON = "flow node 3 on"; const string CHOICE_NODE_OFF = "flow node 3"; [SerializeField] private NodeType m_Type; [SerializeField] private int m_Id; [SerializeField] private Rect m_Rect; [SerializeField] private bool m_Selected; [SerializeField] private List<int> m_Connections = new List<int>(); [SerializeField] private Content m_Content = new Content(); [SerializeField] private string m_Name; [SerializeField] private List<Choice> m_Choices = new List<Choice>(); [SerializeField] private int m_IndexName; public NodeType type { get { return this.m_Type; } set { this.m_Type = value; } } public Vector2 position { get { return this.m_Rect.position; } set { this.m_Rect.position = value; } } public Vector2 size { get { return new Vector2(100f, 35f); } } public string style { get { switch (this.type) { case NodeType.START: return this.selected ? START_NODE_ON : START_NODE_OFF; case NodeType.END: return this.selected ? END_NODE_ON : END_NODE_OFF; case NodeType.TEXT: return this.selected ? TEXT_NODE_ON : TEXT_NODE_OFF; case NodeType.CHOICE: return this.selected ? CHOICE_NODE_ON : CHOICE_NODE_OFF; } return TEXT_NODE_OFF; } } public bool selected { get { return this.m_Selected; } set { this.m_Selected = value; } } public string title { get { return this.content.title; } set { this.content.title = value; } } public int id { get { return this.m_Id; } set { this.m_Id = value; } } public List<int> connections { get { return this.m_Connections; } set { this.m_Connections = value; } } public Rect rect { get { return new Rect(this.position, this.size); } } public Content content { get { return this.m_Content; } set { this.m_Content = value; } } public string name { get { return this.m_Name; } set { this.m_Name = value; } } public List<Choice> choices { get { return this.m_Choices; } set { this.m_Choices = value; } } public int index { get { return this.m_IndexName; } set { this.m_IndexName = value; } } public void ConnectId() { this.content.id = this.id; } } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.