Exemple #1
0
        public IAction GetNextAction()
        {
            // If all actions are complete, retrieve new
            if (this._beforeEachQueue.Count == 0 && this._afterEachQueue.Count == 0 && this._atLocationStartQueue.Count == 0)
            {
                this.RetrieveAtLocationStartAction();
            }

            // Retrieve new BeforeEach and AfterEach if necessary
            if (this._lastCallOrderType == CallOrder.AtLocationStart)
            {
                this._lastCallOrderType = CallOrder.AfterEach;
                this.RetrieveAfterEachActions();
            }
            if (this._lastCallOrderType == CallOrder.AfterEach && this._afterEachQueue.Count == 0)
            {
                this._lastCallOrderType = CallOrder.BeforeEach;
                this.RetrieveBeforeEachActions();
            }

            // If BeforeEach or AfterEach in queue, return dequeue.
            if (this._afterEachQueue.Count > 0)
            {
                LogProxy.Log("Brain.GetNextAction: Dequeued Action of type CallOrder.AfterEach.", true);
                this._lastCallOrderType = CallOrder.AfterEach;

                return(this._afterEachQueue.Dequeue());
            }
            else if (this._beforeEachQueue.Count > 0)
            {
                LogProxy.Log("Brain.GetNextAction: Dequeued Action of type CallOrder.BeforeEach.", true);
                this._lastCallOrderType = CallOrder.BeforeEach;

                return(this._beforeEachQueue.Dequeue());
            }

            // If items are in the AtLocationStart queue
            if (this._atLocationStartQueue.Count > 0)
            {
                LogProxy.Log("Brain.GetNextAction: Dequeued Action of type CallOrder.AtLocationStart.", true);
                this._lastCallOrderType = CallOrder.AtLocationStart;

                return(this._atLocationStartQueue.Dequeue());
            }

            // Bot is finished
            return(null);
        }
Exemple #2
0
 public void action(Character who, GameLocation where, Tile what)
 {
     LogProxy.Log("Action thing happened");
 }