public Dictionary <string, object> goalState  = new Dictionary <string, object>(); // the current goal state of the agent
        //public bool IsBusy { get { return currentPlan != null; } }

        /// <summary>
        /// The agent will perform the actions step by step described in the action sequence.
        /// </summary>
        public IEnumerator PerformActionSequence(Queue <AIAction> actionSequence)
        {
            Queue <AIAction> sequence    = new Queue <AIAction>(actionSequence);
            bool             goalReached = true;

            while (sequence.Count != 0)
            {
                AIAction action = sequence.Dequeue();
                yield return(action.action);
            }

            //while (sequence.Count > 0) {
            //    //Debug.Log("forever running");
            //    AIAction current = sequence.Peek();
            //    yield return StartCoroutine(current.Perform(this));
            //    if (current.IsAborted) {
            //        goalReached = false;
            //        //OnPlanAborted(current);
            //        break;
            //    }
            //    else {
            //        sequence.Dequeue();
            //    }
            //}

            //if (goalReached)
            //    OnGoalReached();

            //currentPlan = null;
        }
            public AIAction action;                   // the action that belongs to the node

            public Node(Node parent, float cost, Dictionary <string, object> state, AIAction action)
            {
                this.parent      = parent;
                this.runningCost = cost;
                this.state       = state;
                this.action      = action;
            }