public LLECommandScope clone() { LLECommandScope scope = new LLECommandScope(mName); for (int i = 0; i < mCommands.Count; i++) { scope.mCommands.Add(mCommands[i].clone()); } return scope; }
public void executeCommand(LLECommand command) { switch (command.mName) { case "goToScope": { LLECommandScope scope = getCommandScope((string)command.mParams[0]); if (scope != null) { mCurrentScope = scope; executeScope(); } break; } //Other commands access gameplay engine } }
//Move this for ScriptManager public void gatherCommands(string scriptFile) { TextReader txtReader = new StreamReader(scriptFile + ".lmn"); string fileText = txtReader.ReadToEnd().Replace("\r", "").Replace("\n", ""); string[] commands = fileText.Replace(" ", "").Split(new char[] { ';' }); LLECommandScope scope = null; for (int i = 0; i < commands.Length; i++) { string[] commandSplit = commands[i].Split(new char[] { '(' }); string commandName = commandSplit[0]; if (commandName != "") { string[] commandParams = commandSplit[1].Replace(")", "").Replace(" ", "").Split(new char[] { ',' }); if (commandName == "startScope") { if (scope != null) { mCmdScopes.Add(scope.clone()); scope = null; } scope = new LLECommandScope(commandParams[0]); } else { scope.mCommands.Add(new LLECommand(commandName)); for (int j = 0; j < commandParams.Length; j++) { scope.mCommands.Last().mParams.Add(commandParams[j]); } } } } if (mCmdScopes.Count == 0) { mCmdScopes.Add(scope.clone()); } }
public LLECommandManager() { mCurrentScope = null; mCmdScopes = new List<LLECommandScope>(); }
public void init() { if(mCmdScopes.Count > 0) { mCurrentScope = mCmdScopes[0]; } }