Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Unity dialogue runner now has helper setters
  • Loading branch information
McJones committed Aug 22, 2019
1 parent 4aedf39 commit 807fb2d
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions Unity/Assets/YarnSpinner/Code/DialogueRunner.cs
Expand Up @@ -482,28 +482,27 @@ public abstract class DialogueUIBehaviour : MonoBehaviour
/// Scripts that can act as a variable storage should subclass this
public abstract class VariableStorageBehaviour : MonoBehaviour, Yarn.VariableStorage
{
/// Get a value
public abstract Value GetValue(string variableName);

/// Not implemented here
public virtual void SetNumber (string variableName, float number)
public virtual void SetValue(string variableName, float floatValue)
{
throw new System.NotImplementedException ();
Value value = new Yarn.Value(floatValue);
this.SetValue(variableName, value);
}

/// Not implemented here
public virtual float GetNumber (string variableName)
public virtual void SetValue(string variableName, bool stringValue)
{
throw new System.NotImplementedException ();
Value value = new Yarn.Value(stringValue);
this.SetValue(variableName, value);
}

/// Get a value
public virtual Value GetValue(string variableName) {
return new Yarn.Value(this.GetNumber(variableName));
public virtual void SetValue(string variableName, string boolValue)
{
Value value = new Yarn.Value(boolValue);
this.SetValue(variableName, value);
}

/// Set a value
public virtual void SetValue(string variableName, Value value) {
this.SetNumber(variableName, value.AsNumber);
}
public abstract void SetValue(string variableName, Value value);

/// Not implemented here
public virtual void Clear ()
Expand Down

0 comments on commit 807fb2d

Please sign in to comment.