示例#1
0
        public static bool HasCurrentKnotBeenVisited(this Ink.Runtime.Story story)
        {
            if (story.state.currentPathString == null)
            {
                return(false);
            }

            int count = story.state.VisitCountAtPathString(story.state.currentPathString);

            return(count > 1);
            //Path currentPath = story.runtime.state.currentPath;
            //if (currentPath != null)
            //{
            //  Path.Component currentHead = currentPath.head;
            //  string key = story.runtime.state.currentPath.head.name;
            //  if (key != null)
            //  {
            //    int timesVisited = story.runtime.state.VisitCountAtPathString(key);
            //    if (timesVisited > 1)
            //      return true;
            //  }
            //}
            //return false;
        }
示例#2
0
 /// <summary>
 /// Dispatches an event in order to retrieve the value of a given variable.
 /// </summary>
 /// <typeparam name="EventType"></typeparam>
 /// <typeparam name="ValueType"></typeparam>
 /// <param name="story">The Ink story object.</param>
 /// <param name="variableName">The name of the variable.</param>
 /// <param name="target">The recipient of the event</param>
 public static void SetVariableValue <ValueType>(Ink.Runtime.Story story, string variableName, ValueType value)
 {
     story.variablesState[variableName] = value;
 }
 public static void GoToStart(this Ink.Runtime.Story story)
 {
     story.ResetCallstack();
 }