Exemplo n.º 1
0
        public IEnumerator Run(InstructionGraph graph, InstructionStore variables, int executionIndex)
        {
            if (This.IsAssigned)
            {
                var value = This.GetValue(variables);

                if (value.Type == VariableType.Empty)
                {
                    Debug.LogWarningFormat(_missingThisWarning, This, name);
                }
                else if (value.Type != VariableType.Null)
                {
                    // null is a valid this object, but primitive types are not

                    if (value.RawObject == null)
                    {
                        Debug.LogWarningFormat(_invalidThisWarning, This, name);
                    }
                    else
                    {
                        variables.ChangeThis(value.RawObject);
                    }
                }
            }

            yield return(Run_(graph, variables, executionIndex));
        }
Exemplo n.º 2
0
        protected IEnumerator Run(InstructionStore variables, InstructionGraphNode root, string source)
        {
            StartRunning(root, source);

            var rootThis = variables.This;

            _rootStore = variables;
            GoTo(root, _rootStore.This, source);

            while (ShouldContinue())
            {
                var frame = SetupFrame(_nextNode);
                _nextNode.Node = null;

                if (frame.Node != null)
                {
                    _callstack.Push(frame);
                    _rootStore.ChangeThis(frame.This);

                    yield return(ProcessFrame(frame));
                }

                if (_shouldBreak)
                {
                    HandleBreak();
                    _shouldBreak = false;
                }
            }

            _callstack.Clear();
            variables.ChangeThis(rootThis);
        }