Пример #1
0
 private void TerminateCurrentScope(bool advance)
 {
     if (advance)
     {
         _currentScope.Statements.Add(new LuaStatement
         {
             Text = "Advance(R)"
         });
     }
     _currentScope = new LuaIfScope
     {
         Condition = $"STATE == {GetNextStateIdx()}",
     };
     _switch.Scopes.Add(_currentScope);
 }
Пример #2
0
        public LuaRoutine(ScripterRoutine routine)
        {
            Name          = routine.Name;
            _switch       = new LuaIf();
            _currentScope = new LuaIfScope
            {
                Condition = $"STATE == {GetNextStateIdx()}",
            };
            Lines.Add(_switch);
            _switch.Scopes.Add(_currentScope);

            // All routine commands are in states
            for (var i = 0; i < routine.Lines.Count; i++)
            {
                var line = routine.Lines[i];
                TranslateLine(line, i);
            }
        }