internal StoryState(Story story)
        {
            this.story = story;

            _outputStream = new List <Runtime.Object> ();
            OutputStreamDirty();

            evaluationStack = new List <Runtime.Object> ();

            callStack      = new CallStack(story.rootContentContainer);
            variablesState = new VariablesState(callStack, story.listDefinitions);

            visitCounts      = new Dictionary <string, int> ();
            turnIndices      = new Dictionary <string, int> ();
            currentTurnIndex = -1;

            // Seed the shuffle random numbers
            int timeSeed = DateTime.Now.Millisecond;

            storySeed      = (new Random(timeSeed)).Next() % 100;
            previousRandom = 0;

            _currentChoices = new List <Choice> ();

            GoToStart();
        }
Ejemplo n.º 2
0
        public StoryState(Story story)
        {
            this.story = story;

            _currentFlow = new Flow(kDefaultFlowName, story);

            OutputStreamDirty();

            evaluationStack = new List <Runtime.Object> ();

            variablesState = new VariablesState(callStack, story.listDefinitions);

            _visitCounts = new Dictionary <string, int> ();
            _turnIndices = new Dictionary <string, int> ();

            currentTurnIndex = -1;

            // Seed the shuffle random numbers
            int timeSeed = DateTime.Now.Millisecond;

            storySeed      = (new Random(timeSeed)).Next() % 100;
            previousRandom = 0;



            GoToStart();
        }
Ejemplo n.º 3
0
        internal void CopyFrom(VariablesState varState)
        {
            _globalVariables     = new Dictionary <string, Object> (varState._globalVariables);
            variableChangedEvent = varState.variableChangedEvent;

            if (varState.batchObservingVariableChanges != batchObservingVariableChanges)
            {
                if (varState.batchObservingVariableChanges)
                {
                    _batchObservingVariableChanges = true;
                    _changedVariables = new HashSet <string> (varState._changedVariables);
                }
                else
                {
                    _batchObservingVariableChanges = false;
                    _changedVariables = null;
                }
            }
        }
Ejemplo n.º 4
0
        internal void CopyFrom(VariablesState toCopy)
        {
            _globalVariables = new Dictionary <string, Object> (toCopy._globalVariables);

            // It's read-only, so no need to create a new copy
            _defaultGlobalVariables = toCopy._defaultGlobalVariables;

            variableChangedEvent = toCopy.variableChangedEvent;

            if (toCopy.batchObservingVariableChanges != batchObservingVariableChanges)
            {
                if (toCopy.batchObservingVariableChanges)
                {
                    _batchObservingVariableChanges = true;
                    _changedVariables = new HashSet <string> (toCopy._changedVariables);
                }
                else
                {
                    _batchObservingVariableChanges = false;
                    _changedVariables = null;
                }
            }
        }