Beispiel #1
0
 private void variableChanged(string name, Ink.Runtime.Object value)
 {
     if (variables.ContainsKey(name))
     {
         variables.Remove(name);
         variables.Add(name, value);
     }
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
    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);
        }
    }