public void AddGameAction(GameAction Action) { try { lock (this.myActions) this.myActions.Add(Action.ActionType, Action); Action.RegisterEnd(this.DelGameAction); Action.Execute(); } catch (Exception e) { Logger.Error(e); } }
public void ReadAndExecute(string eventScript) { GameAction action = interpreter.MakeEvent(eventScript, GameManager.instance.eventManager.InterpreterError); if (action != null) { try { action.Execute(); } catch (ScriptInterpreter.InterpreterException e) { GameManager.instance.eventManager.InterpreterError.Invoke(e.ToString()); } catch (System.Exception e) { GameManager.instance.eventManager.InterpreterError.Invoke("Unknown interpreter error - check your script.\n" + e.ToString()); } } }
private void ProcessActions() { if (activeAction != null) { if (activeAction.CurrentStatus == GameAction.Status.Complete) { activeAction = null; } } else if (actionStack.Count > 0) { activeAction = actionStack.Pop(); activeAction.Execute(); if (activeAction.CurrentStatus == GameAction.Status.Complete) { activeAction = null; ProcessActions(); } } }