diff --git a/Assets/Fungus/Flowchart/Scripts/IVariable.cs b/Assets/Fungus/Flowchart/Scripts/IVariable.cs new file mode 100644 index 00000000..72da5ff6 --- /dev/null +++ b/Assets/Fungus/Flowchart/Scripts/IVariable.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace Fungus +{ + /// + /// A Fungus variable that can be used with Commands. + /// + public interface IVariable + { + /// + /// Visibility scope for the variable. + /// + VariableScope Scope { get; } + + /// + /// String identifier for the variable. + /// + string Key { get; set; } + + /// + /// Callback to reset the variable if the Flowchart is reset. + /// + void OnReset(); + } +} diff --git a/Assets/Fungus/Flowchart/Scripts/IVariable.cs.meta b/Assets/Fungus/Flowchart/Scripts/IVariable.cs.meta new file mode 100644 index 00000000..29e4d18f --- /dev/null +++ b/Assets/Fungus/Flowchart/Scripts/IVariable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 75ff90e0b811142d39cc9031dbf4b992 +timeCreated: 1473856441 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Fungus/Flowchart/Scripts/Variable.cs b/Assets/Fungus/Flowchart/Scripts/Variable.cs index 899d005c..4e7c28d5 100644 --- a/Assets/Fungus/Flowchart/Scripts/Variable.cs +++ b/Assets/Fungus/Flowchart/Scripts/Variable.cs @@ -57,15 +57,21 @@ namespace Fungus /// Abstract base class for variables. /// [RequireComponent(typeof(Flowchart))] - public abstract class Variable : MonoBehaviour + public abstract class Variable : MonoBehaviour, IVariable { [SerializeField] protected VariableScope scope; - public virtual VariableScope Scope { get { return scope; } } [SerializeField] protected string key = ""; + + #region IVariable implementation + + public virtual VariableScope Scope { get { return scope; } } + public virtual string Key { get { return key; } set { key = value; } } public abstract void OnReset(); + + #endregion } ///