Пример #1
0
        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);
            }
        }
Пример #2
0
    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());
            }
        }
    }
Пример #3
0
 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();
         }
     }
 }