private void variableChanged(string name, Ink.Runtime.Object value) { if (variables.ContainsKey(name)) { variables.Remove(name); variables.Add(name, value); } }
public Ink.Runtime.Object GetVariableState(string variableName) { Ink.Runtime.Object variableValue = null; dialogueVaribles.variables.TryGetValue(variableName, out variableValue); if (variableValue == null) { Debug.LogWarning("Ink variable was found to be null: " + variableName); } return(variableValue); }
public DialogueVariables(string globalFilePath) { string inkFileContents = File.ReadAllText(globalFilePath); Ink.Compiler compiler = new Ink.Compiler(inkFileContents); Story globalVariblesStory = compiler.Compile(); variables = new Dictionary <string, Ink.Runtime.Object>(); foreach (string name in globalVariblesStory.variablesState) { Ink.Runtime.Object value = globalVariblesStory.variablesState.GetVariableWithName(name); variables.Add(name, value); Debug.Log("initialize global dialogue variable: " + name + "=" + value); } }