using System; using UnityEngine; namespace EasyTalk.Nodes.Variable { /// /// Defines the structure used for global dialogue variables. /// [Serializable] public class GlobalNodeVariable { /// /// The name of the variable. /// [SerializeField] private string variableName; /// /// The type of the variable. /// [SerializeField] private GlobalVariableType variableType; /// /// The initial value (as a string) of the variable. /// [SerializeField] private string initialValue; /// /// Gets or sets the name of the variable. /// public string VariableName { get { return variableName; } set { variableName = value; } } /// /// Gets or sets the type of the variable. /// public GlobalVariableType VariableType { get { return variableType; } set { variableType = value; } } /// /// Gets or sets the initial value of the variable. /// public string InitialValue { get { return initialValue; } set { initialValue = value; } } /// /// Returns the true type of the variable (int, float, string, or bool). /// /// The true Type of the variable./returns> public Type GetTrueType() { switch (variableType) { case GlobalVariableType.STRING: return typeof(string); case GlobalVariableType.INT: return typeof(int); case GlobalVariableType.FLOAT: return typeof(float); case GlobalVariableType.BOOL: return typeof(bool); } return typeof(object); } } /// /// An enum defining global variable types. /// public enum GlobalVariableType { STRING, INT, FLOAT, BOOL } }