public Node(Node parent, float cost, Dictionary <string, int> states, GAction action)
 {
     this.parent = parent;
     this.cost   = cost;
     this.states = new Dictionary <string, int>(states);
     this.action = action;
 }
        private List <GAction> ActionSubset(List <GAction> actions, GAction targetRemoval)
        {
            List <GAction> subset = new List <GAction>();

            foreach (GAction a in actions)
            {
                if (!a.Equals(targetRemoval))
                {
                    subset.Add(a);
                }
            }
            return(subset);
        }
        private void UpdateActionQueue()
        {
            // If no more actions, remove goal and planner
            if (actionQueue != null && actionQueue.Count == 0)
            {
                if (currentGoal.remove)
                {
                    goals.Remove(currentGoal);
                }
                planner = null;
            }

            // If there are more actions to take, send the next one
            if (actionQueue != null && actionQueue.Count > 0)
            {
                currentAction = actionQueue.Dequeue();
                if (currentAction.PrePerform())
                {
                    if (currentAction.target == null && currentAction.targetTag != "")
                    {
                        currentAction.target = GameObject.FindWithTag(currentAction.targetTag);
                    }
                    if (currentAction.target != null)
                    {
                        currentAction.running = true;

                        destination = currentAction.target.transform.position;
                        Transform dest = currentAction.target.transform.Find("Destination");
                        if (dest != null)
                        {
                            destination = dest.position;
                        }
                        currentAction.agent.SetDestination(destination);
                    }
                }
                else
                {
                    actionQueue = null;
                }
            }
        }
 public Node(Node parent, float cost, Dictionary <string, int> states, Dictionary <string, int> beliefStates, GAction action) : this(parent, cost, states, action)
 {
     foreach (KeyValuePair <string, int> b in beliefStates)
     {
         if (!this.states.ContainsKey(b.Key))
         {
             this.states.Add(b.Key, b.Value);
         }
     }
 }